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 8487184

Browse filesBrowse files
Nitzan Uzielydanielleadams
authored andcommitted
child_process: fix bad abort signal leak
Move abort signal validation to before spawn is executed so that the file is not leaked. PR-URL: #37257 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 1ff375b commit 8487184
Copy full SHA for 8487184

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎lib/child_process.js‎

Copy file name to clipboardExpand all lines: lib/child_process.js
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,11 +758,14 @@ function spawnWithSignal(file, args, options) {
758758
const opts = options && typeof options === 'object' && ('signal' in options) ?
759759
{ ...options, signal: undefined } :
760760
options;
761-
const child = spawn(file, args, opts);
762761

763-
if (options && options.signal) {
762+
if (options?.signal) {
764763
// Validate signal, if present
765764
validateAbortSignal(options.signal, 'options.signal');
765+
}
766+
const child = spawn(file, args, opts);
767+
768+
if (options && options.signal) {
766769
function kill() {
767770
if (child._handle) {
768771
child._handle.kill(options.killSignal || 'SIGTERM');

0 commit comments

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