Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: implement child_process IPC #21490

Merged
merged 37 commits into from
Dec 13, 2023
Merged

fix: implement child_process IPC #21490

merged 37 commits into from
Dec 13, 2023

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Dec 7, 2023

This PR implements the Node child_process IPC functionality in Deno on Unix systems.

For fd > 2 a duplex unix pipe is set up between the parent and child processes. Currently implements data passing via the channel in the JSON serialization format.

runtime/js/99_main.js Show resolved Hide resolved
runtime/ops/process.rs Outdated Show resolved Hide resolved
runtime/ops/process.rs Outdated Show resolved Hide resolved
runtime/ops/process.rs Outdated Show resolved Hide resolved
runtime/ops/process.rs Outdated Show resolved Hide resolved
runtime/ops/process.rs Outdated Show resolved Hide resolved
ext/node/ops/ipc.rs Outdated Show resolved Hide resolved
ext/node/ops/ipc.rs Outdated Show resolved Hide resolved
ext/node/ops/ipc.rs Outdated Show resolved Hide resolved
@littledivy littledivy enabled auto-merge (squash) December 13, 2023 08:32
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please address these comments in a follow up PR.

@@ -69,7 +69,6 @@ import { buildAllowedFlags } from "ext:deno_node/internal/process/per_thread.mjs

const notImplementedEvents = [
"disconnect",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should implement this event as well, but let's do that in a follow up PR.

@@ -203,6 +205,12 @@ class ChildProcess {
#waitPromise;
#waitComplete = false;

#pipeFd;
// internal, used by ext/node
get _pipeFd() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not great. Can you think of a way how we could not expose it to user code? Let's address that in a follow up.

@@ -265,7 +265,91 @@ fn create_command(
value => value.as_stdio(),
});

Ok(command)
#[cfg(unix)]
// TODO(bartlomieju):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address that comment :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants