[Patches] [ python-Patches-1669481 ] subprocess: Support close_fds on Win32

SourceForge.net noreply at sourceforge.net
Mon Apr 23 15:53:32 CEST 2007


Patches item #1669481, was opened at 2007-02-26 16:47
Message generated for change (Comment added) made by jorend
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1669481&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jon Foster (jongfoster)
Assigned to: Nobody/Anonymous (nobody)
Summary: subprocess: Support close_fds on Win32

Initial Comment:
There is an existing close_fds parameter to the subprocess.Popen() constructor that prevents FDs being copied to the child process on UNIX.  This patch makes that parameter also work on Windows (with a caveat).

Setting this parameter on Windows was explicitly prohibited by the code, because it prevents redirecting stdin/stdout/stderr.  However, the check is too restrictive; it is perfectly reasonable to set this flag if you are not redirecting anything.  That is what this patch does.

The behaviour is unchanged if you are on Windows, set this flag, and simultaneously try to redirect stdin/stdout/stderr: the call will fail with an exception.

This patch is against Python SVN trunk.

Kind regards,

Jon Foster


----------------------------------------------------------------------

Comment By: Jason Orendorff (jorend)
Date: 2007-04-23 09:53

Message:
Logged In: YES 
user_id=18139
Originator: NO

Patch looks good.  +1 (but I haven't tested it either).


----------------------------------------------------------------------

Comment By: Georg Brandl (gbrandl)
Date: 2007-03-08 15:28

Message:
Logged In: YES 
user_id=849994
Originator: NO

The patch looks good; unfortunately I don't have a Windows to test it,
otherwise I'd apply it.

----------------------------------------------------------------------

Comment By: Jon Foster (jongfoster)
Date: 2007-03-07 18:11

Message:
Logged In: YES 
user_id=199289
Originator: YES

I've been reading the general discussion on python-dev about patches
needing documentation and tests.  So here's an updated patch that includes
docs and tests.
File Added: subprocess_win32_close_handles_2.patch

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1669481&group_id=5470


More information about the Patches mailing list