question about subprocess and shells

Floris Bruynooghe floris.bruynooghe at gmail.com
Sat Dec 5 05:09:58 EST 2009


On Dec 4, 9:38 pm, Ross Boylan <r... at biostat.ucsf.edu> wrote:
> If one uses subprocess.Popen(args, ..., shell=True, ...)
>
> When args finishes execution, does the shell terminate?  Either way
> seems problematic.

Essentially this is executing "/bin/sh args" so if you're unsure as to
the behaviour just try it on your command line.  Basically once the
pipeline in "args" had finished the shell has nothing more to do and
will return itself (and the return code for the shell depends on the
return code of the pipeline executed which is normally the return code
of the last process executed).

Of course when I say "pipeline" it could also be a single command or a
list or any valid shell.

Regards
Floris



More information about the Python-list mailing list