]> git.tdb.fi Git - builder.git/blobdiff - source/misc.cpp
Set PKG_CONFIG_PATH to include prefix
[builder.git] / source / misc.cpp
index cf97c5506db3526535cfdbbfe3e3a9390224e8e6..2409e05a650a7fb5c67885d799f9359ad550037b 100644 (file)
@@ -15,7 +15,7 @@ Distributed under the LGPL
 using namespace std;
 using namespace Msp;
 
-string run_command(const StringList &argv)
+string run_command(const StringList &argv, int *status)
 {
        int pfd[2];
        pipe(pfd);
@@ -53,8 +53,18 @@ string run_command(const StringList &argv)
                        int len=read(pfd[0], buf, sizeof(buf));
                        if(len<=0)
                        {
-                               if(waitpid(pid, 0, WNOHANG))
+                               int s;
+                               if(waitpid(pid, &s, WNOHANG))
+                               {
+                                       if(status)
+                                       {
+                                               if(WIFEXITED(s))
+                                                       *status=WEXITSTATUS(s);
+                                               else
+                                                       *status=-1;
+                                       }
                                        break;
+                               }
                        }
                        else
                                result.append(buf, len);