Skip to content

Commit c6eef01

Browse files
committed
Disable the debug popup on MSVC/win32
For not popup dialog when crash happend on MSVC/win32 related issue: jerryscript-project#4463 JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
1 parent 514db96 commit c6eef01

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

jerry-main/main-desktop.c

+22-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
#include <stdlib.h>
1919
#include <string.h>
2020

21+
#if defined(_WIN32)
22+
#include <windows.h>
23+
24+
#include <crtdbg.h>
25+
#endif /* _WIN32 */
26+
2127
#include "jerryscript-port.h"
2228
#include "jerryscript.h"
2329

@@ -115,7 +121,22 @@ main (int argc, char **argv)
115121

116122
main_args_t arguments;
117123
arguments.sources_p = sources_p;
118-
124+
#if defined(_WIN32)
125+
if (!IsDebuggerPresent ())
126+
{
127+
/* Disable all of the possible ways Windows conspires to make automated
128+
testing impossible. */
129+
#if defined(_MSC_VER)
130+
_set_error_mode (_OUT_TO_STDERR);
131+
_CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
132+
_CrtSetReportFile (_CRT_WARN, _CRTDBG_FILE_STDERR);
133+
_CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
134+
_CrtSetReportFile (_CRT_ERROR, _CRTDBG_FILE_STDERR);
135+
_CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
136+
_CrtSetReportFile (_CRT_ASSERT, _CRTDBG_FILE_STDERR);
137+
#endif /* _MSC_VER */
138+
}
139+
#endif /* _WIN32 */
119140
if (!main_parse_args (argc, argv, &arguments))
120141
{
121142
return arguments.parse_result;

0 commit comments

Comments
 (0)