question about subprocess and shells

Ross Boylan ross at biostat.ucsf.edu
Fri Dec 4 16:38:11 EST 2009


If one uses subprocess.Popen(args, ..., shell=True, ...)

When args finishes execution, does the shell terminate?  Either way
seems problematic.

If it does not terminate, then it seems as if calls like wait and
communicate would never return.  It also seems the subprocess would
never die, and that most of the examples with the shell True would leave
processes lying around.

If it does terminate, then how can you stuff new commands down the pipe
to the subprocesses stdin?

Does this module contemplate receiving multiple commands for the shell
to execute?

I'm also unsure of the semantics of the pipes for the processes standard
file handles.  Do they need to be closed (judging from the examples,
no)?  When reads/writes to them return, and what state is the stream in
at the time?

Thanks for any wisdom you can offer.
Ross Boylan 




More information about the Python-list mailing list