+typedef struct {
+ gint pid, tag;
+ wxProcess *process;
+} wxEndProcessData;
+
+static void GTK_EndProcessDetector(gpointer data, gint source,
+ GdkInputCondition WXUNUSED(condition) )
+{
+ wxEndProcessData *proc_data = (wxEndProcessData *)data;
+ int pid;
+
+ pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid);
+
+ /* wait4 is not part of any standard, use at own risk
+ * not sure what wait4 does, but wait3 seems to be closest, whats a digit ;-)
+ * --- offer@sgi.com */
+#if !defined(__sgi)
+ wait4(proc_data->pid, NULL, 0, NULL);
+#else
+ wait3((int *) NULL, 0, (rusage *) NULL);
+#endif
+
+ close(source);
+ gdk_input_remove(proc_data->tag);
+
+ if (proc_data->process)
+ proc_data->process->OnTerminate(proc_data->pid);
+
+ if (proc_data->pid > 0)
+ delete proc_data;
+ else
+ proc_data->pid = 0;
+};
+
+long wxExecute( char **argv, bool sync, wxProcess *process )