summaryrefslogtreecommitdiff
path: root/runtime/ops
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/ops')
-rw-r--r--runtime/ops/process.rs15
-rw-r--r--runtime/ops/signal.rs13
2 files changed, 13 insertions, 15 deletions
diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs
index cef4f77f8..a5150950e 100644
--- a/runtime/ops/process.rs
+++ b/runtime/ops/process.rs
@@ -5,7 +5,6 @@ use crate::permissions::PermissionsContainer;
use deno_core::anyhow::Context;
use deno_core::error::type_error;
use deno_core::error::AnyError;
-use deno_core::op;
use deno_core::op2;
use deno_core::serde_json;
use deno_core::AsyncMutFuture;
@@ -334,23 +333,21 @@ fn op_spawn_child(
spawn_child(state, command)
}
-// TODO(bartlomieju): op2 doesn't support clippy allows
-#[op]
+#[op2(async)]
#[allow(clippy::await_holding_refcell_ref)]
+#[serde]
async fn op_spawn_wait(
state: Rc<RefCell<OpState>>,
- rid: ResourceId,
+ #[smi] rid: ResourceId,
) -> Result<ChildStatus, AnyError> {
let resource = state
.borrow_mut()
.resource_table
.get::<ChildResource>(rid)?;
let result = resource.0.try_borrow_mut()?.wait().await?.try_into();
- state
- .borrow_mut()
- .resource_table
- .close(rid)
- .expect("shouldn't have closed until now");
+ if let Ok(resource) = state.borrow_mut().resource_table.take_any(rid) {
+ resource.close();
+ }
result
}
diff --git a/runtime/ops/signal.rs b/runtime/ops/signal.rs
index 8508aa56a..c0279a87c 100644
--- a/runtime/ops/signal.rs
+++ b/runtime/ops/signal.rs
@@ -1,7 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
use deno_core::error::type_error;
use deno_core::error::AnyError;
-use deno_core::op;
use deno_core::op2;
use deno_core::AsyncRefCell;
use deno_core::CancelFuture;
@@ -537,10 +536,11 @@ pub fn signal_int_to_str(s: libc::c_int) -> Result<&'static str, AnyError> {
}
#[cfg(unix)]
-#[op]
+#[op2(fast)]
+#[smi]
fn op_signal_bind(
state: &mut OpState,
- sig: &str,
+ #[string] sig: &str,
) -> Result<ResourceId, AnyError> {
let signo = signal_str_to_int(sig)?;
if signal_hook_registry::FORBIDDEN.contains(&signo) {
@@ -557,10 +557,11 @@ fn op_signal_bind(
}
#[cfg(windows)]
-#[op]
+#[op2(fast)]
+#[smi]
fn op_signal_bind(
state: &mut OpState,
- sig: &str,
+ #[string] sig: &str,
) -> Result<ResourceId, AnyError> {
let signo = signal_str_to_int(sig)?;
let resource = SignalStreamResource {
@@ -605,6 +606,6 @@ pub fn op_signal_unbind(
state: &mut OpState,
#[smi] rid: ResourceId,
) -> Result<(), AnyError> {
- state.resource_table.close(rid)?;
+ state.resource_table.take_any(rid)?.close();
Ok(())
}