Skip to content

Help with IPC and child_process with ES6 #1383

Closed
@sammyrc34

Description

@sammyrc34
  • 8.11.2 & 10.6
  • Linux, debian x86_64
  • runtime
  • child_process

IPC with a ES6 child process created via child_process.fork() appears to go nowhere. When sending a message, the child appears to never receive it. Further testing shows that other events (eg exit) are working.

To demonstrate, parent.mjs:

import cp from 'child_process';
const kid = cp.fork( 'test.mjs' );
kid.send( { msg: "Hey there kid" } );
setTimeout( () => { process.exit(0) }, 2000 );  

And test.mjs

class Test {
  constructor() { }
  msg(message) { console.log( "Kid got", message ); }
}
const test = new Test();
process.on( 'message', (m) => { test.msg(m) } );

To test further, I created my own named socket IPC using net.createServer(path), between such a parent and child, and bidirectional communication is working.

I really just want to know if this is something I should create an issue about.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions