+} // anonymous namespace
+
+int wxAppTraits::WaitForChild(wxExecuteData& execData)
+{
+ if ( !(execData.flags & wxEXEC_SYNC) )
+ {
+ // asynchronous execution: just launch the process and return,
+ // endProcData will be destroyed when it terminates (currently we leak
+ // it if the process doesn't terminate before we do and this should be
+ // fixed but it's not a real leak so it's not really very high
+ // priority)
+ wxEndProcessData *endProcData = new wxEndProcessData;
+ endProcData->process = execData.process;
+ endProcData->pid = execData.pid;
+ endProcData->tag = AddProcessCallback
+ (
+ endProcData,
+ execData.GetEndProcReadFD()
+ );
+ endProcData->async = true;
+
+ return execData.pid;
+ }
+ //else: synchronous execution case
+
+#if HAS_PIPE_INPUT_STREAM
+ wxProcess * const process = execData.process;
+ if ( process && process->IsRedirected() )
+ {
+ // we can't simply block waiting for the child to terminate as we would
+ // dead lock if it writes more than the pipe buffer size (typically
+ // 4KB) bytes of output -- it would then block waiting for us to read
+ // the data while we'd block waiting for it to terminate
+ //
+ // so multiplex here waiting for any input from the child or closure of
+ // the pipe used to indicate its termination
+ wxSelectDispatcher disp;
+
+ wxEndHandler endHandler(disp, execData.GetEndProcReadFD());