summaryrefslogtreecommitdiff
path: root/cli/ops/process.rs
diff options
context:
space:
mode:
authorJoão Souto <joao.jpgs@hotmail.com>2020-03-11 22:19:24 +0000
committerGitHub <noreply@github.com>2020-03-11 18:19:24 -0400
commitfb5c31416d4b9e526ca0fcc134dc8f366e367012 (patch)
treecffd644e8f6b99db10a75ecb6e32879d9f4c3ce0 /cli/ops/process.rs
parent810e4a16bedbc77ef0651f4f24626d98ca566083 (diff)
Add waker to StreamResource to fix hang on close bugs (#4293)
Diffstat (limited to 'cli/ops/process.rs')
-rw-r--r--cli/ops/process.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/cli/ops/process.rs b/cli/ops/process.rs
index 743ffa22b..55080fc2d 100644
--- a/cli/ops/process.rs
+++ b/cli/ops/process.rs
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use super::dispatch_json::{Deserialize, JsonOp, Value};
-use super::io::StreamResource;
+use super::io::{StreamResource, StreamResourceHolder};
use crate::op_error::OpError;
use crate::signal::kill;
use crate::state::State;
@@ -24,11 +24,11 @@ pub fn init(i: &mut Isolate, s: &State) {
fn clone_file(rid: u32, state: &State) -> Result<std::fs::File, OpError> {
let mut state = state.borrow_mut();
- let repr = state
+ let repr_holder = state
.resource_table
- .get_mut::<StreamResource>(rid)
+ .get_mut::<StreamResourceHolder>(rid)
.ok_or_else(OpError::bad_resource_id)?;
- let file = match repr {
+ let file = match repr_holder.resource {
StreamResource::FsFile(ref mut file, _) => file,
_ => return Err(OpError::bad_resource_id()),
};
@@ -127,7 +127,9 @@ fn op_run(
Some(child_stdin) => {
let rid = table.add(
"childStdin",
- Box::new(StreamResource::ChildStdin(child_stdin)),
+ Box::new(StreamResourceHolder::new(StreamResource::ChildStdin(
+ child_stdin,
+ ))),
);
Some(rid)
}
@@ -138,7 +140,9 @@ fn op_run(
Some(child_stdout) => {
let rid = table.add(
"childStdout",
- Box::new(StreamResource::ChildStdout(child_stdout)),
+ Box::new(StreamResourceHolder::new(StreamResource::ChildStdout(
+ child_stdout,
+ ))),
);
Some(rid)
}
@@ -149,7 +153,9 @@ fn op_run(
Some(child_stderr) => {
let rid = table.add(
"childStderr",
- Box::new(StreamResource::ChildStderr(child_stderr)),
+ Box::new(StreamResourceHolder::new(StreamResource::ChildStderr(
+ child_stderr,
+ ))),
);
Some(rid)
}