Capture PID of child process
klappnase
klappnase at web.de
Tue Aug 5 20:02:58 EDT 2003
Bernhard Herzog <bh at intevation.de> wrote in message news:<6qr8403xh2.fsf at salmakis.intevation.de>...
>
> If cmd is a string popen will start a sub-shell so that'd the pid you
> get. You could try to prefix your command with exec so that your
> command's process replaces the shell process (see the shell
> documentation).
Thank you so much for that hint!
> Alternatively you could use a list of strings as the command so that no
> shell is used in the first place, i.e. "prog param" would become
> ["prog", "param"]. This approach has the advantage that you don't have
> to worry about shell quoting but it's less portable because it's not
> even documented (I'll file a bug report for that).
>
This really seems to work, too if I use:
self.pp = popen2.Popen3(cmd.split())
I am just not sure if this is an additional feature or a bug?
Does anyone know this?
Michael
More information about the Python-list
mailing list