]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/utilsgtk.cpp
Solved wxMotif scrolling display problem; added wxImageModule;
[wxWidgets.git] / src / gtk / utilsgtk.cpp
index 28d35e2adc6373c11a8181a77264ea69714937f4..ba3988e15479b2fabbb1d0fdf3240d4d1c35c6df 100644 (file)
@@ -18,6 +18,8 @@
 #include "wx/intl.h"
 #include "wx/log.h"
 
+#include "wx/process.h"
+
 #include <stdarg.h>
 #include <dirent.h>
 #include <string.h>
@@ -29,6 +31,7 @@
 #include <errno.h>
 #include <netdb.h>
 #include <signal.h>
+#include <fcntl.h>          // for O_WRONLY and friends
 
 #include "glib.h"
 #include "gdk/gdk.h"
@@ -266,17 +269,21 @@ static void GTK_EndProcessDetector(gpointer data, gint source,
     /* 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 */
+    // VZ: wait4() will be woken up by a signal, not wait3 - so it's quite
+    //     different (also, wait3() waits for any child, wait4() only for this
+    //     one)
+    int status = -1;
 #if !defined(__sgi)
-    wait4(proc_data->pid, (int*) NULL, 0, (rusage *) NULL);
+    wait4(proc_data->pid, &status, 0, (rusage *) NULL);
 #else
-    wait3((int *) NULL, 0, (rusage *) NULL);
+    wait3(&status, 0, (rusage *) NULL);
 #endif
 
     close(source);
     gdk_input_remove(proc_data->tag);
 
     if (proc_data->process)
-        proc_data->process->OnTerminate(proc_data->pid);
+        proc_data->process->OnTerminate(proc_data->pid, status);
 
     if (proc_data->pid > 0)
         delete proc_data;
@@ -321,6 +328,12 @@ long wxExecute( char **argv, bool sync, wxProcess *process )
        close(STDIN_FILENO);
        close(STDOUT_FILENO);
        close(STDERR_FILENO);
+        // some programs complain about sterr not being open, so
+        // redirect them:
+        open("/dev/null", O_RDONLY);  // stdin
+       open("/dev/null", O_WRONLY);  // stdout
+       open("/dev/null", O_WRONLY);  // stderr
+        
 
 #ifdef _AIX
         execvp ((const char *)*argv, (const char **)argv);