James Burgess <jamestreborburg...@gmail.com> added the comment:

"Can't Fix" that is not true. 

I've just fixed this in 2.7 with a trivial change to subprocesss.py, I think 
it'd work in over versions too.

Note that type shenanigans are already in play in _get_handles, it's looking at 
the types of the parameters being passed in to decide how to get a hold of the 
"handle". The socket module makes a duck type of the file object. The fileno() 
method of the socket object returns a handle not a CRT file descriptor. This is 
exactly the kind of handle that _get_handles() is looking for.

So all that is needed is one more "if" to the sequence of how to get the 
"handle" which for a socket object would be just stdin.fileno() etc.

I've just tested this in a fairly complicated remote job queuing software (a 
commercial product) that has the ability to connect the spooler (on one 
machine) with an arbitrary server machine (linux, osx and now windows) via a 
socket. The job is launched with subprocess.Popen and sockets are wired into 
the stdin,stdout and stderr. Works beautifully now.

I've attached a patch file made with:
$ diff -c subprocess.py.ORIG subprocess.py  > subprocess.py.patch

Apply with:
$ cd  Python-2.7.1/Lib ; patch -p0 < c:/temp/subprocess.py.patch

Cheers,
- James

----------
keywords: +patch
nosy: +James.Burgess
Added file: http://bugs.python.org/file23545/subprocess.py.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1681674>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to