Add a boolean parameter to the ExecuteAndWait static function to indicated
authorChad Rosier <mcrosier@apple.com>
Tue, 26 Mar 2013 23:35:00 +0000 (23:35 +0000)
committerChad Rosier <mcrosier@apple.com>
Tue, 26 Mar 2013 23:35:00 +0000 (23:35 +0000)
if execution failed.  ExecuteAndWait returns -1 upon an execution failure, but
checking the return value isn't sufficient because the wait command may
return -1 as well.  This new parameter is to be used by the clang driver in a
subsequent commit.
Part of rdar://13362359

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178087 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/Program.h
lib/Support/Program.cpp

index a0cc27c0241c2b91d7e34aecf85d8a87dbe5d280..bf650112f2802b9ba292e405754eac6936e9ca87 100644 (file)
@@ -125,7 +125,8 @@ namespace sys {
                               const sys::Path** redirects = 0,
                               unsigned secondsToWait = 0,
                               unsigned memoryLimit = 0,
-                              std::string* ErrMsg = 0);
+                              std::string* ErrMsg = 0,
+                              bool *ExecutionFailed = 0);
 
     /// A convenience function equivalent to Program prg; prg.Execute(..);
     /// @see Execute
index 75bc282d9bd48122cd809bbd5e647a8938e9b93c..201d5c0d3056a45779acab6ecd9e4c4ab54672e1 100644 (file)
@@ -29,12 +29,15 @@ Program::ExecuteAndWait(const Path& path,
                         const Path** redirects,
                         unsigned secondsToWait,
                         unsigned memoryLimit,
-                        std::string* ErrMsg) {
+                        std::string* ErrMsg,
+                        bool *ExecutionFailed) {
   Program prg;
-  if (prg.Execute(path, args, envp, redirects, memoryLimit, ErrMsg))
+  if (prg.Execute(path, args, envp, redirects, memoryLimit, ErrMsg)) {
+    if (ExecutionFailed) *ExecutionFailed = false;
     return prg.Wait(path, secondsToWait, ErrMsg);
-  else
-    return -1;
+  }
+  if (ExecutionFailed) *ExecutionFailed = true;
+  return -1;
 }
 
 void