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.

classification
Title: Subprocess behavior on Windows
Type: behavior Stage: patch review
Components: Documentation, Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: brian.curtin, docs@python, georg.brandl, gregory.p.smith, r.david.murray, rosslagerwall, tim.golden
Priority: normal Keywords: patch

Created on 2010-12-20 07:29 by rosslagerwall, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test.py rosslagerwall, 2010-12-20 07:29 Test file that works on Unix but not Windows
subprocessdoc.diff rosslagerwall, 2010-12-20 07:30 Documentation patch
socketdoc.diff rosslagerwall, 2010-12-20 15:07 Update documentation for socket.makefile()
Messages (6)
msg124382 - (view) Author: Ross Lagerwall (rosslagerwall) (Python committer) Date: 2010-12-20 07:29
On Windows, creating a subprocess does not work when stdin (or stdout or stderr) is set as a file object created from socket.makefile(). An IOError is thrown.

This works fine on Unix so I assume it is a platform limitation rather than a Python bug.

If this is so then this should be documented under the subprocess module.
msg124383 - (view) Author: Ross Lagerwall (rosslagerwall) (Python committer) Date: 2010-12-20 07:30
Attached is a patch to document this.
msg124386 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-20 13:40
This might be an example of the general problem that on windows, sockets and files don't mix well.  You can't use a file in a select call, either.

I think there are two possibilities here: either makefile doesn't produce anything very useful on windows, or there's a bug in either makefile or subprocess.  If the former, the proper place to document it would be in the makefile docs.
msg124389 - (view) Author: Ross Lagerwall (rosslagerwall) (Python committer) Date: 2010-12-20 15:07
Since the code in subprocess gets the underlying fileno of the file-like object (line 819 of subprocess.py), I presume it is an example of the general problem of files and sockets not mixing very well on Windows.

So, I have attached a patch to document this in socket.makefile().

However, I also see that *it* is documented in select.select() that it will not work with Windows file-like objects. Maybe there should still be a note in subprocess.Popen() as per the first patch?
msg124395 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-20 18:14
I think I'll leave that decision up to the doc crew.  My thought was that makefile was supposedly returning a file, therefore it was appropriate to document there that it wasn't really a file on windows, whereas subprocess docs are only talking about files, and it only just so happens that you can pass it a socket on unix by using makefile.
msg124787 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-12-28 11:49
I agree that this belongs in the makefile docs.  Fixed in r87535.
History
Date User Action Args
2022-04-11 14:57:10adminsetgithub: 54948
2010-12-28 11:49:57georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg124787

resolution: fixed
2010-12-20 18:14:56r.david.murraysetassignee: docs@python
messages: + msg124395
nosy: gregory.p.smith, tim.golden, r.david.murray, brian.curtin, docs@python, rosslagerwall
stage: patch review
2010-12-20 15:07:20rosslagerwallsetfiles: + socketdoc.diff
nosy: gregory.p.smith, tim.golden, r.david.murray, brian.curtin, docs@python, rosslagerwall
messages: + msg124389
2010-12-20 13:40:12r.david.murraysetnosy: + tim.golden, brian.curtin, r.david.murray, gregory.p.smith
versions: + Python 3.1
messages: + msg124386

assignee: docs@python -> (no value)
2010-12-20 07:30:13rosslagerwallsetfiles: + subprocessdoc.diff

messages: + msg124383
keywords: + patch
2010-12-20 07:29:15rosslagerwallcreate