Skip to content

node:child_process — fork() + IPC (send/disconnect/'message'/channel) unimplemented #1933

Description

@proggeramlug

Summary

child_process.fork(modulePath[, args][, options]) is not implemented. fork spawns a child running a Node module with an IPC channel wired up, exposing child.send(msg), child.on("message", …), child.disconnect(), and the connected/channel state.

This is the largest remaining piece of #1780. It depends on real async subprocess execution + an IPC channel (see the async-reactor issue), which Perry does not have today — every child currently runs synchronously to completion, so there is no live process to exchange messages with.

What to do

  • Implement fork() returning a ChildProcess with a working IPC channel.
  • child.send(message[, sendHandle][, options][, callback]) serializes message (JSON / advanced serialization) to the child.
  • child.on("message", (msg) => …) fires when the child calls process.send(...).
  • child.disconnect() closes the channel; connected flips to false, channel to null.
  • The child side needs process.send / process.on("message") / process.connected / process.disconnect().

Note: in compiled-Perry there is no node to fork into — fork of a .ts/.js module path implies either re-spawning the compiled Perry binary with an entry selector, or compiling the forked module too. Scope the child-launch strategy as part of this ticket.

Parent: #1780. perry 0.5.1029.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew capability or improvementparityCompatibility gap with Node.js, ECMAScript, or the supported ecosystem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions