Re: subprocess and non-blocking IO (again)

2005-10-11 Thread Nick Craig-Wood
Marc Carter [EMAIL PROTECTED] wrote: import subprocess,select,sys speakers=[] lProc=[] for machine in ['box1','box2','box3']: p = subprocess.Popen( ('echo '+machine+';sleep 2;echo goodbye;sleep 2;echo cruel;sleep 2;echo world'), stdout=subprocess.PIPE,

Re: subprocess and non-blocking IO (again)

2005-10-11 Thread Marc Carter
Donn Cave wrote: If you want to use select(), don't use the fileobject functions. Use os.read() to read data from the pipe's file descriptor (p.stdout.fileno().) This is how you avoid the buffering. Thankyou, this works perfectly. I figured it would be something simple. Marc --

Re: subprocess and non-blocking IO (again)

2005-10-11 Thread Thomas Bellman
Marc Carter [EMAIL PROTECTED] writes: The problem with the above is that the subprocess buffers all its output when used like this and, hence, this automation is not informing me of much :) You may want to take a look at my asyncproc module. With it, you can start subprocesses and let them

subprocess and non-blocking IO (again)

2005-10-10 Thread Marc Carter
I am trying to rewrite a PERL automation which started a monitoring application on many machines, via RSH, and then multiplexed their collective outputs to stdout. In production there are lots of these subprocesses but here is a simplified example what I have so far (python n00b alert!) - SNIP

Re: subprocess and non-blocking IO (again)

2005-10-10 Thread Donn Cave
In article [EMAIL PROTECTED], Marc Carter [EMAIL PROTECTED] wrote: I am trying to rewrite a PERL automation which started a monitoring application on many machines, via RSH, and then multiplexed their collective outputs to stdout. In production there are lots of these subprocesses but