fork/exec with input redirection

Dan Upton upton at
Mon Nov 26 22:58:21 CET 2007

I have a Python script that does a fork/exec, so the parent process
can get the child's PID and monitor /proc/PID/stat (on a CentOS
system).  Most of my processes' command lines are straightforward
enough to do this with, but I have a handful that use < on the command
line, eg

./gobmk_base.linux_x86 --quiet --mode gtp < 13x13.tst

The only thing I could really think of to try was

   os.execv("./gobmk_base.linux_x86", ["./gobmk_base.linux_x86",
"--quiet", "--mode", "gtp", "<", "13x13.tst"])

but this apparently doesn't work.  Is there some other way to
accomplish what I'm going for?


More information about the Python-list mailing list