mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 13:40:20 +03:00
Merge pull request #3148 from CyberShadow/pull-20150405-052650-process-14408
fix Issue 14408 - std.process: Can't start interactive process from Wind...
This commit is contained in:
commit
cdd73be74c
1 changed files with 11 additions and 4 deletions
|
@ -515,8 +515,6 @@ private Pid spawnProcessImpl(in char[] commandLine,
|
|||
// Startup info for CreateProcessW().
|
||||
STARTUPINFO_W startinfo;
|
||||
startinfo.cb = startinfo.sizeof;
|
||||
startinfo.dwFlags = STARTF_USESTDHANDLES;
|
||||
|
||||
static int getFD(ref File f) { return f.isOpen ? f.fileno : -1; }
|
||||
|
||||
// Extract file descriptors and HANDLEs from the streams and make the
|
||||
|
@ -525,8 +523,12 @@ private Pid spawnProcessImpl(in char[] commandLine,
|
|||
out int fileDescriptor, out HANDLE handle)
|
||||
{
|
||||
fileDescriptor = getFD(file);
|
||||
if (fileDescriptor < 0) handle = GetStdHandle(stdHandle);
|
||||
else handle = file.windowsHandle;
|
||||
handle = null;
|
||||
if (fileDescriptor >= 0)
|
||||
handle = file.windowsHandle;
|
||||
// Windows GUI applications have a fd but not a valid Windows HANDLE.
|
||||
if (handle is null || handle == INVALID_HANDLE_VALUE)
|
||||
handle = GetStdHandle(stdHandle);
|
||||
|
||||
DWORD dwFlags;
|
||||
if (GetHandleInformation(handle, &dwFlags))
|
||||
|
@ -550,6 +552,11 @@ private Pid spawnProcessImpl(in char[] commandLine,
|
|||
prepareStream(stdout, STD_OUTPUT_HANDLE, "stdout", stdoutFD, startinfo.hStdOutput);
|
||||
prepareStream(stderr, STD_ERROR_HANDLE, "stderr", stderrFD, startinfo.hStdError );
|
||||
|
||||
if ((startinfo.hStdInput != null && startinfo.hStdInput != INVALID_HANDLE_VALUE)
|
||||
|| (startinfo.hStdOutput != null && startinfo.hStdOutput != INVALID_HANDLE_VALUE)
|
||||
|| (startinfo.hStdError != null && startinfo.hStdError != INVALID_HANDLE_VALUE))
|
||||
startinfo.dwFlags = STARTF_USESTDHANDLES;
|
||||
|
||||
// Create process.
|
||||
PROCESS_INFORMATION pi;
|
||||
DWORD dwCreationFlags =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue