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: nodejs#15299
Fixes: nodejs#13983
PR-URL: nodejs#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 cjihrig committed Sep 14, 2017
1 parent b8d532c commit ed2f347
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 @@ -356,6 +356,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 @@ -93,6 +93,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 ed2f347

Please sign in to comment.