Have sys::FindProgramByName return a std::string.
[oota-llvm.git] / utils / not / not.cpp
index dd89b8f11c0e4a93d6fcddc3fae4939ea9fa5edc..45322ecffc3544f912a5c51f7abc70e0504abd62 100644 (file)
@@ -7,11 +7,21 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/System/Path.h"
-#include "llvm/System/Program.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/Program.h"
+#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 int main(int argc, const char **argv) {
-  sys::Path Program = sys::Program::FindProgramByName(argv[1]);
-  return !sys::Program::ExecuteAndWait(Program, argv + 1);
+  std::string Program = sys::FindProgramByName(argv[1]);
+
+  std::string ErrMsg;
+  int Result =
+      sys::ExecuteAndWait(sys::Path(Program), argv + 1, 0, 0, 0, 0, &ErrMsg);
+  if (Result < 0) {
+    errs() << "Error: " << ErrMsg << "\n";
+    return 1;
+  }
+
+  return Result == 0;
 }