Skip to content

Commit 972af58

Browse files
authored
WASI: support emulated signals in InterceptTraps.cpp (#67393)
When building with `_WASI_EMULATED_SIGNAL` excluding signal support on WASI is no longer needed.
1 parent 390beb9 commit 972af58

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

stdlib/private/StdlibUnittest/InterceptTraps.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
// No signals support on WASI yet, see https://github.com/WebAssembly/WASI/issues/166.
14-
#if !defined(__wasi__)
1513
#include <stdio.h>
1614
#include <signal.h>
1715
#include <string.h>
18-
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
16+
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__wasi__)
1917
#include <unistd.h>
2018
#endif
2119
#if defined(_WIN32)
@@ -50,8 +48,6 @@ static void CrashCatcher(int Sig) {
5048
_exit(0);
5149
}
5250

53-
#endif // __wasi__
54-
5551
#if defined(_WIN32)
5652
static LONG WINAPI
5753
VectoredCrashHandler(PEXCEPTION_POINTERS ExceptionInfo) {
@@ -74,9 +70,6 @@ void installTrapInterceptor() {
7470
// Disable buffering on stdout so that everything is printed before crashing.
7571
setbuf(stdout, 0);
7672

77-
// No signals support on WASI yet, see https://github.com/WebAssembly/WASI/issues/166.
78-
#if !defined(__wasi__)
79-
8073
#if defined(_WIN32)
8174
_set_abort_behavior(0, _WRITE_ABORT_MSG);
8275
#endif
@@ -93,5 +86,3 @@ void installTrapInterceptor() {
9386
signal(SIGSYS, CrashCatcher);
9487
#endif
9588
}
96-
97-
#endif // !defined(__wasi__)

0 commit comments

Comments
 (0)