Przeglądaj źródła

tprbuilder: return a nonzero exit code if a command run by tprbuilder returned a nonzero exit code.

git-svn-id: file:///var/svn/tigccpp/trunk@1323 9552661e-59e3-4036-b4f2-dbe53926924f
debrouxl 15 lat temu
rodzic
commit
2d1fa0fe65
1 zmienionych plików z 15 dodań i 3 usunięć
  1. 15 3
      tigcc/tprbuilder/src/tprbuilder.c

+ 15 - 3
tigcc/tprbuilder/src/tprbuilder.c

@@ -3,7 +3,7 @@
 
    Copyright (C) 2002 Romain Liévin
    Copyright (C) 2002-2007 Kevin Kofler
-   Copyright (C) 2005 Lionel Debroux
+   Copyright (C) 2005, 2009 Lionel Debroux
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -24,6 +24,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#ifndef __WIN32__
+#include <sys/wait.h>
+#endif
 
 #include "tprbuilder.h"
 
@@ -376,13 +379,22 @@ int delete(char *filename)
 */
 int execute(char *cmdline)
 {
+    int exitcode;
+
     if (!quiet) {
         fprintf(stderr, "tprbuilder: %s\n", cmdline);
     }
 
-    if(system(cmdline) != 0) {
-        exit(0);
+    exitcode = system(cmdline);
+#ifdef __WIN32__
+    if (exitcode != 0) {
+        exit(exitcode);
+    }
+#else
+    if (WEXITSTATUS(exitcode) != 0) {
+        exit(WEXITSTATUS(exitcode));
     }
+#endif
 
     return 0;
 }