File tree 2 files changed +21
-1
lines changed 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -385,7 +385,7 @@ class ProcessWrap : public HandleWrap {
385
385
}
386
386
#ifdef _WIN32
387
387
if (signal != SIGKILL && signal != SIGTERM && signal != SIGINT &&
388
- signal != SIGQUIT) {
388
+ signal != SIGQUIT && signal != 0 ) {
389
389
signal = SIGKILL;
390
390
}
391
391
#endif
Original file line number Diff line number Diff line change @@ -58,3 +58,23 @@ if (common.isWindows) {
58
58
} ) ;
59
59
process . kill ( 'SIGHUP' ) ;
60
60
}
61
+
62
+ // Test that the process is not killed when sending a 0 signal.
63
+ // This is a no-op signal that is used to check if the process is alive.
64
+ const code = `const interval = setInterval(() => {}, 1000);
65
+ process.stdin.on('data', () => { clearInterval(interval); });
66
+ process.stdout.write('x');` ;
67
+
68
+ const checkProcess = spawn ( process . execPath , [ '-e' , code ] ) ;
69
+
70
+ checkProcess . on ( 'exit' , ( code , signal ) => {
71
+ assert . strictEqual ( code , 0 ) ;
72
+ assert . strictEqual ( signal , null ) ;
73
+ } ) ;
74
+
75
+ checkProcess . stdout . on ( 'data' , common . mustCall ( ( chunk ) => {
76
+ assert . strictEqual ( chunk . toString ( ) , 'x' ) ;
77
+ checkProcess . kill ( 0 ) ;
78
+ checkProcess . stdin . write ( 'x' ) ;
79
+ checkProcess . stdin . end ( ) ;
80
+ } ) ) ;
You can’t perform that action at this time.
0 commit comments