Browse Source

child_process: add .stdin stream to forks

Remove test as it doesn't make any sense after the latest stdio API
changes.
v0.9.1-release
Fedor Indutny 13 years ago
parent
commit
0a89e8b838
  1. 3
      lib/child_process.js
  2. 32
      test/simple/test-child-process-fork3.js

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);
};

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);
Loading…
Cancel
Save