+ else
+ {
+ // we're in parent
+ close(end_proc_detect[1]); // close writing side
+ data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
+ GTK_EndProcessDetector, (gpointer)data);
+ if ( sync )
+ {
+ wxASSERT_MSG( !process, "wxProcess param ignored for sync exec" );
+ data->process = NULL;
+
+ // sync execution: indicate it by negating the pid
+ data->pid = -pid;
+
+ // it will be set to 0 from GTK_EndProcessDetector
+ while (data->pid != 0)
+ wxYield();
+
+ int exitcode = data->exitcode;
+
+ delete data;
+
+ return exitcode;
+ }
+ else
+ {
+ // async execution, nothing special to do - caller will be
+ // notified about the process terminationif process != NULL, data
+ // will be deleted in GTK_EndProcessDetector
+ data->process = process;
+ data->pid = pid;
+
+ return pid;
+ }
+ }
+}