Skip to content

--watch mode disables IPC communication between a spawning process and the actual child process #50880

Description

@znewsham

Version

v18.17.1

Platform

Linux zacknewsham-xps 6.2.0-33-generic #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 10:33:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

This isn't quite a bug, nor is it quite a feature request, but somewhere in between when using watch mode.

in parent.js

import { spawn } from 'child_process';
spawn(
  'node',
  '--watch',
  'child.js'
);

child.sendMessage({ type: "whatever" }, console.log);

in child.js

process.on("message", console.log);

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

I expect to be able to communicate with a spawned child process, even when using --watch.

What do you see instead?

Because the --watch mode uses IPC itself (to listen to messages from the child process) it doesn't pass through messages from the child to the parent, or the parent to the child.

Additional information

As I said, this isn't quite a bug - but not quite a feature request either. I believe the fix is relatively simple, if the process has IPC enabled, then pass through messages (that aren't watch related) from the child -> parent and all messages from parent -> child

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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