-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
child_process: add signal support to spawn
PR-URL: #36432 Backport-PR-URL: #38386 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
- Loading branch information
1 parent
6c08c9d
commit 0b691ce
Showing
3 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Flags: --experimental-abortcontroller | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const cp = require('child_process'); | ||
|
||
// Verify that passing an AbortSignal works | ||
const controller = new AbortController(); | ||
const { signal } = controller; | ||
|
||
const echo = cp.spawn('echo', ['fun'], { | ||
encoding: 'utf8', | ||
shell: true, | ||
signal | ||
}); | ||
|
||
echo.on('error', common.mustCall((e) => { | ||
assert.strictEqual(e.name, 'AbortError'); | ||
})); | ||
|
||
controller.abort(); |