- case '"':
- insideQuotes = !insideQuotes;
- // fall through
-
- default:
- commandName += *pc;
- continue; // skip the next break
- }
-
- // only reached for space not inside quotes
- break;
- }
- wxString commandArgs = pc;
-
- wxWindow *winTop = wxTheApp->GetTopWindow();
- HWND hwndTop = (HWND)(winTop ? winTop->GetHWND() : 0);
-
- HANDLE result;
-#ifdef __GNUWIN32__
- result = ShellExecute(hwndTop,
- (const wchar_t)"open",
- (const wchar_t)commandName,
- (const wchar_t)commandArgs,
- (const wchar_t)NULL,
- SW_SHOWNORMAL);
-#else // !GNUWIN32
- result = ShellExecute(hwndTop, "open", commandName,
- commandArgs, NULL, SW_SHOWNORMAL);
-#endif // GNUWIN32
-
- if ( ((long)result) <= 32 )
- wxLogSysError(_("Can't execute command '%s'"), command.c_str());
-
- return result;
-#else // 1
-
- HANDLE h_readPipe[2];
- HANDLE h_writePipe[2];
- HANDLE h_oldreadPipe;
- HANDLE h_oldwritePipe;
- BOOL inheritHandles;
-
- // ------------------------------------
- // Pipe handling
- // We are in the case of opening a pipe
- inheritHandles = FALSE;
- if (handler && handler->NeedPipe()) {
+ // the IO redirection is only supported with wxUSE_STREAMS
+ BOOL redirect = FALSE;
+#if wxUSE_STREAMS
+ // the first elements are reading ends, the second are the writing ones
+ HANDLE hpipeStdin[2],
+ hpipeStdout[2],
+ hpipeStderr[2];
+ HANDLE hpipeStdinWrite = INVALID_HANDLE_VALUE;
+
+ // open the pipes to which child process IO will be redirected if needed
+ if ( handler && handler->IsRedirected() )
+ {
+ // default secutiry attributes