English 中文(简体)
为什么我能通过结构与再分配交流?
原标题:Why can t I interact with redis-cli via fabric?

我肩负着类似的任务:

@task
def cli():
    command = [
        os.path.join(env.servers_path, "bin", "redis-cli"),
    ]

    run(" ".join(command))

发言给我带来了迅速但又没有互动:

$ fab cli                                            
[server] Executing task  cli 

[server] Executing task  redis.cli 
[server] run: /path/to/bin/redis-cli
[server] out: redis 127.0.0.1:6379> help
<no output produced>

打字进一步产生“排外:”促使我身边,但我根本不能再重新处理。

然而,如果我转向其他一些互动的迅速行动,我确实有互动性:

@task
def cli():
    command = [
        "python"
    ]

    run(" ".join(command))

生产:

$ fab cli                                            
[server] Executing task  cli 
[server] run: python
[server] out: Python 2.4.3 (#1, Sep  3 2009, 15:37:37) 
[server] out: [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
[server] out: Type "help", "copyright", "credits" or "license" for more information.
[server] out: >>> a = 1
[server] out: >>> a
[server] out: 1
[server] out: >>> 

谁能向我提出任何背心,说明为什么再三行事? 我愿向该项目开一个灯塔,但我首先要更好地了解该项目。

最佳回答

我认为,这是由于互动方式的重新定位实际上是为了与终点站合作,而结构则可能将标准投入/投稿人重新定位。

例如,以下指挥系统进行罚款:

python | cat

而以下则不:

redis-cli | cat

提供类似阅读设施的再分配图书馆和线性图书馆没有用非终端档案记录员正确抽取产出。 我没有尝试过一个可能的工作,是打破僵局:

TERM=dumb redis-cli | cat

通过将词汇表变数确定为umb,在非常基本的编码道路上将违约情况定下来,即使用简单的文字处理产出在显示之后的迅速变化。 只要你能够在加工环境中确定这一变量,就可以通过结构解决你的问题。

问题回答

我刚刚找到一个简单而冷静的答案;通过回响和管道寄出你所需要的一切:

  • echo "keys *" | redis-cli
  • or specifically for your case: run("echo keys * | redis-cli")




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签