diff options
Diffstat (limited to 'lib/CompilerDriver/Action.cpp')
-rw-r--r-- | lib/CompilerDriver/Action.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/CompilerDriver/Action.cpp b/lib/CompilerDriver/Action.cpp index 3503bd39db..54b55d0d42 100644 --- a/lib/CompilerDriver/Action.cpp +++ b/lib/CompilerDriver/Action.cpp @@ -53,18 +53,18 @@ namespace { #endif } - int ExecuteProgram (const std::string& name, - const StrVector& args) { + int ExecuteProgram (const std::string& name, const StrVector& args) { sys::Path prog(name); - if (!prog.isAbsolute()) + if (!prog.isAbsolute()) { prog = FindExecutable(name, ProgramName, (void *)(intptr_t)&Main); - if (prog.isEmpty()) { - prog = sys::Program::FindProgramByName(name); - if (prog.isEmpty()) { - PrintError("Can't find program '" + name + "'"); - return -1; + if (!prog.canExecute()) { + prog = sys::Program::FindProgramByName(name); + if (prog.isEmpty()) { + PrintError("Can't find program '" + name + "'"); + return -1; + } } } if (!prog.canExecute()) { |