From e88b6ab92d7ed9dd629d608cf6f4e20f9a81bd09 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 7 Mar 2023 10:54:46 +0300 Subject: [PATCH] Hide Windows fault message box on Windows during make test --- ir-test.php | 8 +++++++- ir_main.c | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ir-test.php b/ir-test.php index 2e60d30..1f40a39 100644 --- a/ir-test.php +++ b/ir-test.php @@ -50,14 +50,20 @@ function run_test($build_dir, $test, $name, $code, $expect, $args) { } else { $cmd = "$build_dir\\ir $input $args --no-abort-fault >$output 2>&1"; } - $ret = @system($cmd); + $ret = @system($cmd, $result_code); if ($ret === false) { return false; } + if ($result_code) { + } $out = @file_get_contents($output); if ($out === false) { return false; } + if ($result_code) { + $out = "\nExit Code = $result_code\n"; + file_put_contents($output, $out); + } $out = trim($out); $out = str_replace("\r", "", $out); if ($out !== $expect) { diff --git a/ir_main.c b/ir_main.c index 51494ab..57f5e71 100644 --- a/ir_main.c +++ b/ir_main.c @@ -9,6 +9,10 @@ #include #include +#ifdef _WIN32 +# include +#endif + static void help(const char *cmd) { printf( @@ -370,6 +374,7 @@ int main(int argc, char **argv) #ifdef _WIN32 if (!abort_fault) { _set_abort_behavior(0, _WRITE_ABORT_MSG|_CALL_REPORTFAULT); + SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX); } #endif