Skip to content

Commit a75612f

Browse files
committed
Support: Do not check if a file exists before executing
Let the actual syscall error if the file doesn't exist. This produces a more standard "no such file or directory" phrasing of the error message, and avoids an extra step. The same antipattern appears in the windows code, we should probably fix that one too.
1 parent b57e63b commit a75612f

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

llvm/lib/Support/Unix/Program.inc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,6 @@ static bool Execute(ProcessInfo &PI, StringRef Program,
168168
ArrayRef<std::optional<StringRef>> Redirects,
169169
unsigned MemoryLimit, std::string *ErrMsg,
170170
BitVector *AffinityMask, bool DetachProcess) {
171-
if (!llvm::sys::fs::exists(Program)) {
172-
if (ErrMsg)
173-
*ErrMsg = std::string("Executable \"") + Program.str() +
174-
std::string("\" doesn't exist!");
175-
return false;
176-
}
177-
178171
assert(!AffinityMask && "Starting a process with an affinity mask is "
179172
"currently not supported on Unix!");
180173

llvm/test/tools/llvm-rc/windres-preproc.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
;; Test error messages when unable to execute the preprocessor.
2121

2222
; RUN: not llvm-windres --preprocessor intentionally-missing-executable %p/Inputs/empty.rc %t.res 2>&1 | FileCheck %s --check-prefix=CHECK4
23-
; CHECK4: llvm-rc: Preprocessing failed: Executable "intentionally-missing-executable" doesn't exist!
23+
; CHECK4: llvm-rc: Preprocessing failed: posix_spawn failed: No such file or directory
2424

2525
;; Test --preprocessor with an argument with spaces.
2626

0 commit comments

Comments
 (0)