Skip to content

Child Process: fork stdio option doesn't support the String variant that spawn does #10793

Closed
@SEUH

Description

Version: v7.4.0
Platform: Windows 64 bit

The following code forks a script but all it's stdio objects are null

index.js

var child = childProcess.fork('./userapp/test.js', [], {
  stdio: 'pipe'
});
console.log('stdio', child.stdio);

test.js

var count = 0;
setInterval(function () {
  if (count == 3) process.exit(1);
  console.log('test: ' + count);
  count++;
}, 1000, 0);

console output:

stdio [ null, null, null, null ]
test: 0
test: 1
test: 2

Also i've tried to set the childs stdio with stdio: [stream, stream, stream] but this didn't work and the child used the parents stream to output

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.feature requestIssues that request new features to be added to Node.js.good first issueIssues that are suitable for first-time contributors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions