summaryrefslogtreecommitdiff
path: root/utils/not
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2014-11-04 01:29:59 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2014-11-04 01:29:59 +0000
commit58206dd147266725b006e551d9942def0c252d89 (patch)
tree11917e3663e53665a02e66a3394bf74b84271f6b /utils/not
parent376a2e104f9ab97dd8f6c4fc52a656ad823d1a88 (diff)
Use findProgramByName.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221221 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/not')
-rw-r--r--utils/not/not.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/utils/not/not.cpp b/utils/not/not.cpp
index a5c7183bd2c..2adeded51f0 100644
--- a/utils/not/not.cpp
+++ b/utils/not/not.cpp
@@ -27,10 +27,15 @@ int main(int argc, const char **argv) {
if (argc == 0)
return 1;
- std::string Program = sys::FindProgramByName(argv[0]);
+ auto Program = sys::findProgramByName(argv[0]);
+ if (!Program) {
+ errs() << "Error: Unable to find `" << argv[0]
+ << "' in PATH: " << Program.getError().message() << "\n";
+ return 1;
+ }
std::string ErrMsg;
- int Result = sys::ExecuteAndWait(Program, argv, nullptr, nullptr, 0, 0,
+ int Result = sys::ExecuteAndWait(*Program, argv, nullptr, nullptr, 0, 0,
&ErrMsg);
#ifdef _WIN32
// Handle abort() in msvcrt -- It has exit code as 3. abort(), aka