diff options
Diffstat (limited to 'utils/not')
-rw-r--r-- | utils/not/not.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/utils/not/not.cpp b/utils/not/not.cpp index ebd1618..a5c7183 100644 --- a/utils/not/not.cpp +++ b/utils/not/not.cpp @@ -30,7 +30,16 @@ int main(int argc, const char **argv) { std::string Program = sys::FindProgramByName(argv[0]); std::string ErrMsg; - int Result = sys::ExecuteAndWait(Program, argv, 0, 0, 0, 0, &ErrMsg); + 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 + // unreachable, should be recognized as a crash. However, some binaries use + // exit code 3 on non-crash failure paths, so only do this if we expect a + // crash. + if (ExpectCrash && Result == 3) + Result = -3; +#endif if (Result < 0) { errs() << "Error: " << ErrMsg << "\n"; if (ExpectCrash) |