Permalink
Browse files

child_process: add .stdin stream to forks

Remove test as it doesn't make any sense after the latest stdio API
changes.
  • Loading branch information...
1 parent 057b806 commit 0a89e8b838caf0769807c4e9a665a70d2e63b032 @indutny indutny committed Jun 18, 2012
Showing with 2 additions and 33 deletions.
  1. +2 −1 lib/child_process.js
  2. +0 −32 test/simple/test-child-process-fork3.js
View
3 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'] :
+ [0, 1, 2, 'ipc'];
return spawn(process.execPath, args, options);
};
View
32 test/simple/test-child-process-fork3.js
@@ -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);

0 comments on commit 0a89e8b

Please sign in to comment.