Skip to content

Commit

Permalink
child_process: set shell to false in fork()
Browse files Browse the repository at this point in the history
This commit ensures that spawn()'s shell option is unconditionally
set to false when fork() is called.

Refs: #15299
Fixes: #13983
PR-URL: #15352
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
Alex Gresnel authored and MylesBorins committed Nov 21, 2017
1 parent 5339983 commit 15ced00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ output on this fd is expected to be line delimited JSON objects.
*Note: Unlike the fork(2) POSIX system call, `child_process.fork()` does
not clone the current process.*

*Note*: The `shell` option available in [`child_process.spawn()`][] is not
supported by `child_process.fork()` and will be ignored if set.

### child_process.spawn(command[, args][, options])
<!-- YAML
added: v0.1.90
Expand Down
1 change: 1 addition & 0 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ exports.fork = function(modulePath /*, args, options*/) {
}

options.execPath = options.execPath || process.execPath;
options.shell = false;

return spawn(options.execPath, args, options);
};
Expand Down

0 comments on commit 15ced00

Please sign in to comment.