Remove duplication in Program::Execute{And,No}Wait.

Implemented by moving the code out of static functions into methods of Program
class.

llvm-svn: 76340
diff --git a/llvm/lib/System/Program.cpp b/llvm/lib/System/Program.cpp
index eb289d8..a3049d46 100644
--- a/llvm/lib/System/Program.cpp
+++ b/llvm/lib/System/Program.cpp
@@ -22,6 +22,33 @@
 //===          independent code.
 //===----------------------------------------------------------------------===//
 
+int
+Program::ExecuteAndWait(const Path& path,
+                        const char** args,
+                        const char** envp,
+                        const Path** redirects,
+                        unsigned secondsToWait,
+                        unsigned memoryLimit,
+                        std::string* ErrMsg) {
+  Program prg;
+  if (prg.Execute(path, args, envp, redirects, memoryLimit, ErrMsg))
+    return prg.Wait(secondsToWait, ErrMsg);
+  else
+    return -1;
+}
+
+void
+Program::ExecuteNoWait(const Path& path,
+                       const char** args,
+                       const char** envp,
+                       const Path** redirects,
+                       unsigned memoryLimit,
+                       std::string* ErrMsg) {
+  Program prg;
+  prg.Execute(path, args, envp, redirects, memoryLimit, ErrMsg);
+}
+
+
 }
 
 // Include the platform-specific parts of this class.