This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jfmeinel
Recipients
Date 2006-07-31.16:53:53
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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
History
Date User Action Args
2007-08-23 14:41:48adminlinkissue1531862 messages
2007-08-23 14:41:48admincreate