Message29392
I'm currently using subprocess.Popen() to run a
command, and I allow the caller to specify where the
output should go.
One valid output is to send it to sys.stdout (fileno == 1)
The subprocess module seems to unconditionally close
stdout if a file handle is passed (even if it stdout).
Compare:
python -c "import subprocess,sys; \
subprocess.Popen(['echo', 'hello'])"
versus
python -c "import subprocess,sys; \
subprocess.Popen(['echo', 'hello'], stdout=sys.stdout)"
or even
python -c "import subprocess,sys; \
subprocess.Popen(['echo', 'hello'], stdout=1)"
The first one prints 'hello' as expected.
The latter two give an error:
echo: write error: Bad file descriptor
Attached is a possible patch to subprocess.py |
|
Date |
User |
Action |
Args |
2007-08-23 14:41:48 | admin | link | issue1531862 messages |
2007-08-23 14:41:48 | admin | create | |
|