summaryrefslogtreecommitdiff
path: root/runtime/worker.rs
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2023-12-15 16:20:05 +0530
committerGitHub <noreply@github.com>2023-12-15 11:50:05 +0100
commit81a6504e670d32bdc5e0a8328c328fdf8e208913 (patch)
tree27a90846e42edd1863e45e9792375d7777f10667 /runtime/worker.rs
parent62e3f5060ef9cc6a31b3e496dd15548c0abd07e6 (diff)
refactor: setup child process pipe in Rust (#21579)
Avoid passing the fd into JS and back into Rust. Instead we setup the child's end of the pipe directly using a special Rust op.
Diffstat (limited to 'runtime/worker.rs')
-rw-r--r--runtime/worker.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/worker.rs b/runtime/worker.rs
index 94b0d9606..549a6cdd6 100644
--- a/runtime/worker.rs
+++ b/runtime/worker.rs
@@ -487,7 +487,16 @@ impl MainWorker {
}
pub fn bootstrap(&mut self, options: BootstrapOptions) {
- self.js_runtime.op_state().borrow_mut().put(options.clone());
+ // Setup bootstrap options for ops.
+ {
+ let op_state = self.js_runtime.op_state();
+ let mut state = op_state.borrow_mut();
+ state.put(options.clone());
+ if let Some(node_ipc_fd) = options.node_ipc_fd {
+ state.put(deno_node::ChildPipeFd(node_ipc_fd));
+ }
+ }
+
let scope = &mut self.js_runtime.handle_scope();
let args = options.as_v8(scope);
let bootstrap_fn = self.bootstrap_fn_global.take().unwrap();