get pid from popen3 or get redirection in execl
Alex Martelli
aleax at aleax.it
Thu Apr 17 06:44:55 EDT 2003
Yu Wang wrote:
> Hi,all
> Does "execl", or whatever this family, support redirection of output?
exec...* are the system calls on top of which redirection of output
is implemented by the shell (there's also a fork in between of course).
> Say, I have a script: ( on my Linux7.2,C shell environment,with
> python2.2.1)
>
> command="somecommand"
> arg="-i somefile > output file"
> execl(command,arg)
>
> what's wrong with this?
You have not involved the shell, so the "> whatever" syntax ain't
gonna fly (who would be parsing it?). You can explicitly invoke
/bin/sh -c "whatever >theoutputfile" if you wish; or else, do it
at a lower level (with os.dup2 and friends, fork maybe, then exec).
> And,
> how could I get child pid from "popen3(somecommand)".
http://www.python.org/doc/current/lib/popen3-objects.html
Alex
More information about the Python-list
mailing list