Skip to content

message not received in child process when forked with --eval #11948

@kevinsawicki

Description

@kevinsawicki
  • Version: 7.7.3
  • Platform: Darwin 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
  • Subsystem: child_process

Messages sent to a process forked using --eval are not received by the child process.

var ChildProcess = require('child_process')

var source = "process.on('message', function (msg) { process.send(msg) })"

var forked = ChildProcess.fork('--eval', [source])

forked.on('message', function (msg) {
  console.log('message received:', msg)
})

forked.send('message')

Output with Node 7.0.0:

message received: message

No output will be logged for any Node version past 7.0.0, including latest 7.7.3.

Calling forked.send after a delay of ~50ms does cause the message to be received in the forked process on 7.7.3.

Refs electron/electron#8944

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions