Skip to content

Instantly share code, notes, and snippets.

@indutny

indutny/1.patch Secret

Created June 18, 2012 21:28
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 indutny/fffde7f21393ba3c48f1 to your computer and use it in GitHub Desktop.
Save indutny/fffde7f21393ba3c48f1 to your computer and use it in GitHub Desktop.
commit d98b7ec693070cde2da6dd14cf6527e406a8416f
Author: Fedor Indutny <fedor.indutny@gmail.com>
Date: Tue Jun 19 01:27:21 2012 +0400
child_process: add .stdin stream to forks
Remove test as it doesn't make any sense after the latest stdio API
changes.
diff --git a/lib/child_process.js b/lib/child_process.js
index fa6c1c7..7866885 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -437,7 +437,8 @@ exports.fork = function(modulePath /*, args, options*/) {
// Leave stdin open for the IPC channel. stdout and stderr should be the
// same as the parent's if silent isn't set.
- options.stdio = options.silent ? ['ipc', 'pipe', 'pipe'] : ['ipc', 1, 2];
+ options.stdio = options.silent ? ['pipe', 'pipe', 'pipe', 'ipc'] :
+ ['pipe', 1, 2, 'ipc'];
return spawn(process.execPath, args, options);
};
diff --git a/test/simple/test-child-process-fork3.js b/test/simple/test-child-process-fork3.js
deleted file mode 100644
index a8a8985..0000000
--- a/test/simple/test-child-process-fork3.js
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var common = require('../common');
-var assert = require('assert');
-var fork = require('child_process').fork;
-
-var filename = common.fixturesDir + '/destroy-stdin.js';
-
-// Ensure that we don't accidentally close fd 0 and
-// reuse it for something else, it causes all kinds
-// of obscure bugs.
-process.stdin.destroy();
-fork(filename).stdin.on('end', process.exit);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment