Skip to content

Instantly share code, notes, and snippets.

@mmalecki
Created January 2, 2012 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmalecki/6695c76213a1ca56bbb4 to your computer and use it in GitHub Desktop.
Save mmalecki/6695c76213a1ca56bbb4 to your computer and use it in GitHub Desktop.
diff --git a/lib/child_process.js b/lib/child_process.js
index b3e6383..6898a99 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -167,10 +167,6 @@ exports.fork = function(modulePath, args, options) {
throw new Error('customFds not allowed for fork()');
}
- // Leave stdin open for the IPC channel. stdout and stderr should be the
- // same as the parent's if silent isn't set.
- options.customFds = (options.silent ? [-1, -1, -1] : [-1, 1, 2]);
-
// Just need to set this - child process won't actually use the fd.
// For backwards compat - this can be changed to 'NODE_CHANNEL' before v0.6.
if (!options.env) options.env = { };
@@ -181,6 +177,11 @@ exports.fork = function(modulePath, args, options) {
var child = spawn(process.execPath, args, options);
+ if (!options.silent) {
+ child.stdout.pipe(process.stdout, { end: false });
+ child.stderr.pipe(process.stderr, { end: false });
+ }
+
setupChannel(child, options.stdinStream);
child.on('exit', function() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment