Skip to content

Conversation

@vsemozhetbyt
Copy link
Contributor

Checklist
Affected core subsystem(s)

doc, child_process

child.stderr, child.stdin, and child.stdout are null, not undefined, if the relevant stdio properties are set to anything other than 'pipe':

console.log(
  require('child_process').spawn(
    'echo', { stdio: ['ignore', 'ignore', 'ignore'] }
  )
);
ChildProcess {
  domain: null,
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined,
  _closesNeeded: 1,
  _closesGot: 0,
  connected: false,
  signalCode: null,
  exitCode: null,
  killed: false,
  spawnfile: 'echo',
  _handle: Process { owner: [Circular], onexit: [Function], pid: 4252 },
  spawnargs: [ 'echo' ],
  pid: 4252,
  stdin: null,
  stdout: null,
  stderr: null,
  stdio: [ null, null, null ] }

The relevant test checks null values.

@nodejs-github-bot nodejs-github-bot added child_process Issues and PRs related to the child_process subsystem. doc Issues and PRs related to the documentations. labels Mar 20, 2017
`child.stderr`, `child.stdin`, and `child.stdout`
are `null`, not `undefined`, if the relevant `stdio` properties
are set to anything other than 'pipe'.
jasnell pushed a commit that referenced this pull request Mar 22, 2017
`child.stderr`, `child.stdin`, and `child.stdout`
are `null`, not `undefined`, if the relevant `stdio` properties
are set to anything other than 'pipe'.

PR-URL: #11949
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell
Copy link
Member

jasnell commented Mar 22, 2017

Landed in 76279cb

@jasnell jasnell closed this Mar 22, 2017
@vsemozhetbyt vsemozhetbyt deleted the child_process-md-stdio branch March 22, 2017 16:27
@sam-github
Copy link
Contributor

@vsemozhetbyt does this need backporting? At what time did it change? Are there unit tests asserting this behaviour?

@vsemozhetbyt
Copy link
Contributor Author

@sam-github

console.log(`// v8 ${process.versions.node}`);

const child = require('child_process').spawn(
  'echo', { stdio: ['ignore', 'ignore', 'ignore'] }
);

console.log(child.stdin, child.stdout, child.stderr);
// v8 4.8.1
null null null

// v8 6.10.1
null null null

// v8 7.7.4
null null null

// v8 8.0.0-nightly20170321ab2d49bcac
null null null

There is a test checking the null. It seems it is rather old.

@sam-github
Copy link
Contributor

OK, thanks, the docs can be (should be?) backported then, I labelled.

MylesBorins pushed a commit that referenced this pull request Mar 28, 2017
`child.stderr`, `child.stdin`, and `child.stdout`
are `null`, not `undefined`, if the relevant `stdio` properties
are set to anything other than 'pipe'.

PR-URL: #11949
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Mar 28, 2017
@italoacasas italoacasas mentioned this pull request Apr 10, 2017
2 tasks
MylesBorins pushed a commit that referenced this pull request Apr 18, 2017
`child.stderr`, `child.stdin`, and `child.stdout`
are `null`, not `undefined`, if the relevant `stdio` properties
are set to anything other than 'pipe'.

PR-URL: #11949
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 19, 2017
`child.stderr`, `child.stdin`, and `child.stdout`
are `null`, not `undefined`, if the relevant `stdio` properties
are set to anything other than 'pipe'.

PR-URL: #11949
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Apr 19, 2017
andrew749 pushed a commit to michielbaird/node that referenced this pull request Jul 19, 2017
`child.stderr`, `child.stdin`, and `child.stdout`
are `null`, not `undefined`, if the relevant `stdio` properties
are set to anything other than 'pipe'.

PR-URL: nodejs/node#11949
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

child_process Issues and PRs related to the child_process subsystem. doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants