So, here's my dilemma:
I need to act on input from either sys.stdin, or from
myProcess = subprocess.Popen(["command","args"], stderr=subprocess.PIPE)
myProcess.stderr
depending on which on is readable. I've attempted to use
select.select([myProcess.stderr,sys.stdin],[],[]), but the myProcess.stderr
won't go back to an "unready" state after I've executed it once.
Here's a redaction of the code I've tried to get working:
myProc = subprocess.Popen(["server.bin"], stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
while True:
inStreams, outStreams, errStreams =
select.select([myProcess.stderr,sys.stdin],[],[])
for stream in inStreams:
data = stream.read()
doAction(data)
Without the subprocess module in this, it works as expected (I can use
select on stdin and sys.stderr for example). As soon as I use the
subprocess file descriptor, it never closes or gets back to an "unready"
state.
My question is: is their a way to reset the subprocess
--
Todd Millecam
--------------------
BYU Unix Users Group
http://uug.byu.edu/
The opinions expressed in this message are the responsibility of their
author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
___________________________________________________________________
List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list