os.execlp and stdout
noah at noah.org
Thu Mar 25 19:32:28 CET 2004
"Melissa Wallis" <mwallis at swri.org> wrote in message news:<105untml7a9ob12 at corp.supernews.com>...
> In a Python script I start a number of C++ processes using os.execlp. Most
> of these processes output messages for debugging purposes at this time. The
> problem I am having is that by starting 4 or 5 processes from my Python
> script I don't get the cout messages they write. I have tried redirecting
> stdout to a file but I get everything but the output from the C++ processes.
> Any suggestions.
They may be writing to stdout, but that doesn't mean it goes to your screen.
How are you starting the processes? You must first be calling fork
and then calling execlp. It would be good if you explained how you
create your child processes -- show an example from your code.
Probably your child processes are getting disconnected from your tty so their
output goes nowhere. Usually this is what you want to happen and most
fork/exec examples will do this. ... On the other hand, the very simplest
fork/exec should cause your child processes to use the
same stdout as the parent. Since you are not seeing this it makes me
suspect that your code is doing something extra to prevent this.
More information about the Python-list