| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 72484e5 commit 1fc0a41
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -158,8 +158,8 @@ function setupKillAndExit() { | |||
| 158 | 158 | } | |
| 159 | 159 | ||
| 160 | 160 | // preserve null signal | |
| 161 | - if (0 === sig) { | ||
| 162 | - err = process._kill(pid, 0); | ||
| 161 | + if (sig === (sig | 0)) { | ||
| 162 | + err = process._kill(pid, sig); | ||
| 163 | 163 | } else { | |
| 164 | 164 | sig = sig || 'SIGTERM'; | |
| 165 | 165 | if (constants[sig]) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,16 +57,19 @@ assert.throws(function() { process.kill(1 / 0); }, | |||
| 57 | 57 | assert.throws(function() { process.kill(-1 / 0); }, | |
| 58 | 58 | invalidPidArgument); | |
| 59 | 59 | ||
| 60 | - // Test that kill throws an error for invalid signal | ||
| 61 | - const unknownSignal = common.expectsError({ | ||
| 60 | + // Test that kill throws an error for unknown signal names | ||
| 61 | + common.expectsError(() => process.kill(0, 'test'), { | ||
| 62 | 62 | code: 'ERR_UNKNOWN_SIGNAL', | |
| 63 | 63 | type: TypeError, | |
| 64 | 64 | message: 'Unknown signal: test' | |
| 65 | 65 | }); | |
| 66 | 66 | ||
| 67 | - | ||
| 68 | - assert.throws(function() { process.kill(1, 'test'); }, | ||
| 69 | - unknownSignal); | ||
| 67 | + // Test that kill throws an error for invalid signal numbers | ||
| 68 | + common.expectsError(() => process.kill(0, 987), { | ||
| 69 | + code: 'EINVAL', | ||
| 70 | + type: Error, | ||
| 71 | + message: 'kill EINVAL' | ||
| 72 | + }); | ||
| 70 | 73 | ||
| 71 | 74 | // Test kill argument processing in valid cases. | |
| 72 | 75 | // | |
@@ -99,6 +102,11 @@ kill(0, undefined, 0, 15); | |||
| 99 | 102 | kill('0', 'SIGHUP', 0, 1); | |
| 100 | 103 | kill('0', undefined, 0, 15); | |
| 101 | 104 | ||
| 105 | + // Confirm that numeric signal arguments are supported | ||
| 106 | + | ||
| 107 | + kill(0, 1, 0, 1); | ||
| 108 | + kill(0, 15, 0, 15); | ||
| 109 | + | ||
| 102 | 110 | // negative numbers are meaningful on unix | |
| 103 | 111 | kill(-1, 'SIGHUP', -1, 1); | |
| 104 | 112 | kill(-1, undefined, -1, 15); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments