Skip to content

Commit 9421d01

Browse files
committed
StdlibUnittest: prevent abort dialog on Windows
Adjust the abort behaviour on Windows. The aborts would cause a large number of dialogs to appear. This reduces the load a bit and is crucial for getting tests to run without manual intervention.
1 parent 3027784 commit 9421d01

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

stdlib/private/StdlibUnittest/InterceptTraps.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#if defined(_WIN32)
2020
#include <io.h>
2121
#include <process.h>
22+
#include <stdlib.h>
2223
#endif
2324

2425
#include "swift/Runtime/Config.h"
@@ -50,6 +51,10 @@ void installTrapInterceptor() {
5051
// Disable buffering on stdout so that everything is printed before crashing.
5152
setbuf(stdout, 0);
5253

54+
#if defined(_WIN32)
55+
_set_abort_behavior(1, _WRITE_ABORT_MSG);
56+
#endif
57+
5358
signal(SIGILL, CrashCatcher);
5459
signal(SIGABRT, CrashCatcher);
5560
signal(SIGFPE, CrashCatcher);

0 commit comments

Comments
 (0)