]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/utilsgtk.cpp
the Russian translations were somehow corrupted, fixed
[wxWidgets.git] / src / gtk / utilsgtk.cpp
index f1346abc17b2edef3668b446a1ac2a23fde3f5e5..1bc1106f93e420c45945d76e6a8c140b809139cd 100644 (file)
@@ -139,8 +139,9 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
 // subprocess routines
 // ----------------------------------------------------------------------------
 
-static void GTK_EndProcessDetector(gpointer data, gint source,
-                                   GdkInputCondition WXUNUSED(condition) )
+extern "C"
+void GTK_EndProcessDetector(gpointer data, gint source,
+                            GdkInputCondition WXUNUSED(condition) )
 {
    wxEndProcessData *proc_data = (wxEndProcessData *)data;
 
@@ -148,12 +149,19 @@ static void GTK_EndProcessDetector(gpointer data, gint source,
    // generate G_IO_HUP notification even when it simply tries to read from a
    // closed fd and hasn't terminated at all
    int pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid);
-   if ( waitpid(pid, NULL, WNOHANG) == 0 )
+   int status = 0;
+   int rc = waitpid(pid, &status, WNOHANG);
+
+   if ( rc == 0 )
    {
        // no, it didn't exit yet, continue waiting
        return;
    }
 
+   // set exit code to -1 if something bad happened
+   proc_data->exitcode = rc != -1 && WIFEXITED(status) ? WEXITSTATUS(status)
+                                                      : -1;
+
    // child exited, end waiting
    close(source);