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 @@ -60,3 +60,23 @@ if (common.isWindows) {
60
60
} ) ;
61
61
process . kill ( 'SIGHUP' ) ;
62
62
}
63
+
64
+ // Test that the process is not killed when sending a 0 signal.
65
+ // This is a no-op signal that is used to check if the process is alive.
66
+ const code = `const interval = setInterval(() => {}, 1000);
67
+ process.stdin.on('data', () => { clearInterval(interval); });
68
+ process.stdout.write('x');` ;
69
+
70
+ const checkProcess = spawn ( process . execPath , [ '-e' , code ] ) ;
71
+
72
+ checkProcess . on ( 'exit' , ( code , signal ) => {
73
+ assert . strictEqual ( code , 0 ) ;
74
+ assert . strictEqual ( signal , null ) ;
75
+ } ) ;
76
+
77
+ checkProcess . stdout . on ( 'data' , common . mustCall ( ( chunk ) => {
78
+ assert . strictEqual ( chunk . toString ( ) , 'x' ) ;
79
+ checkProcess . kill ( 0 ) ;
80
+ checkProcess . stdin . write ( 'x' ) ;
81
+ checkProcess . stdin . end ( ) ;
82
+ } ) ) ;
You can’t perform that action at this time.
0 commit comments