Skip to content

Commit 011cb6f

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 bacc54a commit 011cb6f

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

jerry-main/main-unix.c

+20-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
#include <stdio.h>
1818
#include <stdlib.h>
1919
#include <string.h>
20+
#if defined (_WIN32)
21+
#include <crtdbg.h>
22+
#include <Windows.h>
23+
#endif
2024

2125
#include "jerryscript.h"
2226
#include "jerryscript-ext/debugger.h"
@@ -60,7 +64,22 @@ main (int argc,
6064

6165
main_args_t arguments;
6266
arguments.sources_p = sources_p;
63-
67+
#if defined (_WIN32)
68+
if (!IsDebuggerPresent ())
69+
{
70+
/* Disable all of the possible ways Windows conspires to make automated
71+
testing impossible. */
72+
#if defined (_MSC_VER)
73+
_set_error_mode (_OUT_TO_STDERR);
74+
_CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
75+
_CrtSetReportFile (_CRT_WARN, _CRTDBG_FILE_STDERR);
76+
_CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
77+
_CrtSetReportFile (_CRT_ERROR, _CRTDBG_FILE_STDERR);
78+
_CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
79+
_CrtSetReportFile (_CRT_ASSERT, _CRTDBG_FILE_STDERR);
80+
#endif
81+
}
82+
#endif
6483
main_parse_args (argc, argv, &arguments);
6584

6685
#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)

0 commit comments

Comments
 (0)