Message78136
os.pipe should return inheritable descriptors on Windows.
Patch below, test attached. New pipe() returns descriptors, which
cannot be inherited. However, their permissions are set correctly, so
msvcrt.get_osfhandle and msvcrt.open_osfhandle can be used to obtain an
inheritable handle.
Docs should contain a note to the effect. 'On Windows, use
msvcrt.get_osfhandle to obtain a handle to the descriptor which can be
inherited. In a subprocess, use msvcrt.open_osfhandle to obtain a new
corresponding descriptor.'
--- posixmodule_orig.c 2008-12-20 20:01:38.296875000 -0600
+++ posixmodule_new.c 2008-12-20 20:01:54.359375000 -0600
@@ -6481,8 +6481,12 @@
HANDLE read, write;
int read_fd, write_fd;
BOOL ok;
+ SECURITY_ATTRIBUTES sAttribs;
Py_BEGIN_ALLOW_THREADS
- ok = CreatePipe(&read, &write, NULL, 0);
+ sAttribs.nLength = sizeof( sAttribs );
+ sAttribs.lpSecurityDescriptor = NULL;
+ sAttribs.bInheritHandle = TRUE;
+ ok = CreatePipe(&read, &write, &sAttribs, 0);
Py_END_ALLOW_THREADS
if (!ok)
return win32_error("CreatePipe", NULL); |
|
Date |
User |
Action |
Args |
2008-12-21 02:15:25 | castironpi | set | recipients:
+ castironpi |
2008-12-21 02:15:25 | castironpi | set | messageid: <1229825725.05.0.791696937909.issue4708@psf.upfronthosting.co.za> |
2008-12-21 02:15:24 | castironpi | link | issue4708 messages |
2008-12-21 02:15:22 | castironpi | create | |
|