Skip to content

Instantly share code, notes, and snippets.

@mmalecki mmalecki/child_process.patch Secret
Created Jan 2, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.