Skip to content

Instantly share code, notes, and snippets.

@hail2u
Last active August 29, 2015 14:14
Show Gist options
  • Save hail2u/d8896c857278acc1b4d3 to your computer and use it in GitHub Desktop.
Save hail2u/d8896c857278acc1b4d3 to your computer and use it in GitHub Desktop.
3rd `spawnSync()` with shared `options` argument throws exception
~/Desktop $ node test.js
desktop.ini  test.js
desktop.ini  test.js
child_process.js:905
      throw new TypeError('Incorrect value for stdio stream: ' +
            ^
TypeError: Incorrect value for stdio stream: { type: 'fd', fd: { type: 'fd', fd: 0 } }
    at child_process.js:905:13
    at Array.reduce (native)
    at _validateStdio (child_process.js:829:17)
    at spawnSync (child_process.js:1251:19)
    at Object.<anonymous> (c:\Users\Kyo\Desktop\test.js:13:10)
    at Module._compile (module.js:446:26)
    at Object.Module._extensions..js (module.js:464:10)
    at Module.load (module.js:341:32)
    at Function.Module._load (module.js:296:12)
    at Function.Module.runMain (module.js:487:10)
~/Desktop $ node test2.js
desktop.ini  test.js
desktop.ini  test.js
desktop.ini  test.js
#!/usr/bin/env node
'use strict';
var spawn = require('child_process').spawnSync;
var ls;
var opts = {
stdio: 'inherit'
};
ls = spawn('ls', [], opts);
ls = spawn('ls', [], opts);
ls = spawn('ls', [], opts);
#!/usr/bin/env node
'use strict';
var spawn = require('child_process').spawnSync;
var ls;
ls = spawn('ls', [], {
stdio: 'inherit'
});
ls = spawn('ls', [], {
stdio: 'inherit'
});
ls = spawn('ls', [], {
stdio: 'inherit'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment