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 jasnell committed Sep 20, 2017
1 parent 427bf80 commit 607832d
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 @@ -95,6 +95,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 607832d

Please sign in to comment.