Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d5d56ec

Browse filesBrowse files
Trottdanielleadams
authored andcommitted
test: add test for reused AbortController with execfile()
Test that reusing an aborted AbortController with execfile() results in immediate SIGTERM. PR-URL: #36644 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
1 parent 190ddce commit d5d56ec
Copy full SHA for d5d56ec

File tree

Expand file treeCollapse file tree

1 file changed

+15
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-2
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-child-process-execfile.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-execfile.js
+15-2Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,24 @@ const execOpts = { encoding: 'utf8', shell: true };
5353
const ac = new AbortController();
5454
const { signal } = ac;
5555

56-
const callback = common.mustCall((err) => {
56+
const firstCheck = common.mustCall((err) => {
5757
assert.strictEqual(err.code, 'ABORT_ERR');
5858
assert.strictEqual(err.name, 'AbortError');
59+
assert.strictEqual(err.signal, undefined);
60+
});
61+
62+
const secondCheck = common.mustCall((err) => {
63+
assert.strictEqual(err.code, null);
64+
assert.strictEqual(err.name, 'Error');
65+
assert.strictEqual(err.signal, 'SIGTERM');
5966
});
60-
execFile(process.execPath, [echoFixture, 0], { signal }, callback);
67+
68+
execFile(process.execPath, [echoFixture, 0], { signal }, (err) => {
69+
firstCheck(err);
70+
// Test that re-using the aborted signal results in immediate SIGTERM.
71+
execFile(process.execPath, [echoFixture, 0], { signal }, secondCheck);
72+
});
73+
6174
ac.abort();
6275
}
6376

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.