From a8d35a9101d93750b3cce64c410b616fefcf3d11 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 14 Jan 2021 20:49:35 -0800 Subject: [PATCH] Disable the debug popup. For not popup dialog when crash happend on MSVC/win32 related issue: #4463 JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com --- jerry-main/main-unix.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/jerry-main/main-unix.c b/jerry-main/main-unix.c index 87fdddc3eb..a773cf3609 100644 --- a/jerry-main/main-unix.c +++ b/jerry-main/main-unix.c @@ -17,6 +17,10 @@ #include #include #include +#if defined (_WIN32) +#include +#include +#endif #include "jerryscript.h" #include "jerryscript-ext/debugger.h" @@ -62,7 +66,22 @@ main (int argc, main_args_t arguments; arguments.sources_p = sources_p; - +#if defined (_WIN32) + if (!IsDebuggerPresent ()) + { + /* Disable all of the possible ways Windows conspires to make automated + testing impossible. */ +#if defined (_MSC_VER) + _set_error_mode (_OUT_TO_STDERR); + _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile (_CRT_WARN, _CRTDBG_FILE_STDERR); + _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile (_CRT_ERROR, _CRTDBG_FILE_STDERR); + _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile (_CRT_ASSERT, _CRTDBG_FILE_STDERR); +#endif + } +#endif main_parse_args (argc, argv, &arguments); #if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)