From: Reid Kleckner Date: Thu, 10 Sep 2015 23:59:45 +0000 (+0000) Subject: Add .exe check to Execute to fix clang-modernize tests broken in r247358 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=fbf486927f3c127208c06cb500410efd6b291ee0 Add .exe check to Execute to fix clang-modernize tests broken in r247358 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247361 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/Windows/Program.inc b/lib/Support/Windows/Program.inc index c29d8729b1d..fe83118b064 100644 --- a/lib/Support/Windows/Program.inc +++ b/lib/Support/Windows/Program.inc @@ -251,6 +251,14 @@ static bool Execute(ProcessInfo &PI, StringRef Program, const char **args, return false; } + // can_execute may succeed by looking at Program + ".exe". CreateProcessW + // will implicitly add the .exe if we provide a command line without an + // executable path, but since we use an explicit executable, we have to add + // ".exe" ourselves. + SmallString<64> ProgramStorage; + if (!sys::fs::exists(Program)) + Program = Twine(Program + ".exe").toStringRef(ProgramStorage); + // Windows wants a command line, not an array of args, to pass to the new // process. We have to concatenate them all, while quoting the args that // have embedded spaces (or are empty).