diff options
author | Reid Kleckner <rnk@google.com> | 2015-09-10 23:59:45 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2015-09-10 23:59:45 +0000 |
commit | 95ce1df93a52bd5bd23334cec1e4bbb206f5554c (patch) | |
tree | 798c0d3271c360a53ab252b6335f6c6383ed9b78 /llvm/lib/Support/Windows/Program.inc | |
parent | c3f09ffa4de02f8e44acdc3bbe87087b9c960848 (diff) | |
download | llvm-95ce1df93a52bd5bd23334cec1e4bbb206f5554c.zip llvm-95ce1df93a52bd5bd23334cec1e4bbb206f5554c.tar.gz llvm-95ce1df93a52bd5bd23334cec1e4bbb206f5554c.tar.bz2 |
Add .exe check to Execute to fix clang-modernize tests broken in r247358
llvm-svn: 247361
Diffstat (limited to 'llvm/lib/Support/Windows/Program.inc')
-rw-r--r-- | llvm/lib/Support/Windows/Program.inc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Support/Windows/Program.inc b/llvm/lib/Support/Windows/Program.inc index c29d872..fe83118 100644 --- a/llvm/lib/Support/Windows/Program.inc +++ b/llvm/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). |