Skip to content

Wait for message from parent before closing #693

Closed
@ORESoftware

Description

@ORESoftware

I am on Node.js version 6-8

I have a child process file with this in it:

process.on('message', function(){

});

this process seems to shut down as soon as I start it.

Now if I add a setTimeout to it:

process.on('message', function(){

});

setTimeout(function(){

   console.log('timed out');

},3000);

then the process will close only after the timeout.

I swear it wasn't like this before. It was working with just process.on('message'). Did something with Node.js change with newer versions?

Anyway how can I wait for a message from the parent process before closing? One would think process.on('message') would keep the process open until the listener was removed -or- process.exit() is called, etc.

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