A way to discover PIDs of child processes?

Donn Cave donn at u.washington.edu
Fri Feb 17 14:37:11 EST 2006


In article <1140198823.896123.221240 at g44g2000cwa.googlegroups.com>,
 schreckmail at yahoo.com wrote:

> Now, because the command is executed in the shell, I end up with the
> following process tree:
> 
>       PID    PPID    PGID     WINPID  TTY  UID    STIME COMMAND
>      2332    3156    2332       3412  con 1012 15:34:11
> /usr/bin/python2.4
>      3068    2332    2332       2268  con 1012 15:34:11 /usr/bin/sh
>      1584    3068    2332       2620  con 1012 15:34:12
> /cygdrive/c/GNATPRO/5.01
> a/bin/powerpc-elf-gdb

It doesn't always have to be that way, depending on the
nature of the command.  If it's the last thing the shell
has to do, then it can be exec'ed without a fork, which
leaves the gdb image running in the immediate child process.

Some shells do that automatically.  In any case, a Bourne
shell "exec" statement will do it, like "exec /.../gdb",
with whatever redirections etc.

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list