Skip to content

ProcessSpec cannot pass extra descriptors or control the session: blocks Perry's child_process #38

Description

@proggeramlug

Perry's P2 migration moved child stdout/stderr pipes, dgram and signals onto turnloop, but child spawn and exit could not move, because ProcessSpec cannot express what Node's child_process needs:

  1. Extra descriptors. ProcessSpec.stdio is exactly three entries. Node's fork() requires the IPC channel at fd 3 with NODE_CHANNEL_FD set, and spawn's stdio option takes an arbitrary list (['pipe','pipe','pipe','ipc','pipe',…]). turnloop needs a way to pass additional descriptors/handles at fixed child fd numbers (Windows: inherited handles plus the handle-value environment convention Node uses).
  2. Session / process-group control at spawn. detached exists (added for IOCP: CTRL_CLOSE_EVENT, CREATE_NO_WINDOW, KILL_ON_JOB_CLOSE and sync-handle semantics #11), but Perry also needs the pre-exec behaviour its current spawn path performs. Say explicitly which of those turnloop will own.

Alternative that would also unblock it: Loop::adopt_process(pid, …) — let the host spawn (keeping its own pre_exec, fd plan and reaping today) and hand turnloop only the exit watch. Note Perry has three other waitpid callers (spawnSync, execSync, pty) in the same process, so who reaps must be stated: an adopted-process API must not steal their children's status.

Whichever is chosen must keep exactly-once completion, the existing kill/close ordering, and grandchild cleanup (job object on Windows, process group on Unix).

Verification: a child with five descriptors where fds 3 and 4 carry real bytes both ways; NODE_CHANNEL_FD-style handoff; adopted-process exit status with a sibling waitpid caller present; Windows equivalents for inherited handles.

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