[issue12262] Not Inheriting File Descriptors on Windows?

2011-06-03 Thread Jesse Litton

New submission from Jesse Litton <3vi...@gmail.com>:

On Windows, I've been trying to call a test script that gets its I/O handled 
via file descriptors 3 & 4 

  socat EXEC:"python test.py userid",pty,fdin=3,fdout=4 TCP4:server:23,crlf

But I'm getting "[Errno 9] Bad file descriptor" when the python script attempts 
to os.fdopen(3, 'r').

I've tried just piping an echo's output redirected (3<&1 I think... though I 
might have that backwards as I've tried it every conceivable way) into the 
script, but I always get the bad file descriptor error.

I can create a pipe() in the program I can get an actual FD 3 & 4... but they 
seem to have no relation to the FD's that were set up by the invoking 
command-line/script.

I'm new to Python - is there something simple I'm overlooking, or is this a 
known bug that I just haven't been able to find in my last few hours of web 
searches?  I can't believe I would be the only one doing this type of 
redirection on Windows.

Thanks in advance for any guidance/resolution you can offer.

--
components: Interpreter Core
messages: 137582
nosy: 3vi1
priority: normal
severity: normal
status: open
title: Not Inheriting File Descriptors on Windows?
type: behavior
versions: Python 3.1

___
Python tracker 
<http://bugs.python.org/issue12262>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12262] Not Inheriting File Descriptors on Windows?

2011-06-07 Thread Jesse Litton

Jesse Litton <3vi...@gmail.com> added the comment:

Yes, socat was compiled under cygwin.  I'll have to investigate whether I want 
to go the route of cygwin separately or just just leave the script as a pure 
stdin/out filter (since neither I nor the users have the cygwin environment 
installed).

After reading what you said, I re-read the MS notes 
(http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true)
 and finally noticed the 'specific to each tool' text next to the description 
for handles 3-9.
 
Just to be sure, I came up with this simple test:

   echo test 1>&3 | set /P TEST= 0<&3

Which basically squashes my misconception, as it doesn't work.

So, I believe now that what I wanted is beyond the capabilities of the common 
Windows command shell, and this can be closed/invalid as not being a Python 
issue.  I also wish I was home using my Linux box about now.  :)

Thank you all very much for taking the time to help educate me on this!

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 
<http://bugs.python.org/issue12262>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com