summaryrefslogtreecommitdiff
path: root/cli/ops/runtime.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/ops/runtime.rs')
-rw-r--r--cli/ops/runtime.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/cli/ops/runtime.rs b/cli/ops/runtime.rs
index 55f0d9f57..b4fb3c496 100644
--- a/cli/ops/runtime.rs
+++ b/cli/ops/runtime.rs
@@ -9,19 +9,19 @@ use deno_core::CoreIsolate;
use deno_core::ModuleSpecifier;
use deno_core::ZeroCopyBuf;
use std::env;
+use std::rc::Rc;
-pub fn init(i: &mut CoreIsolate, s: &State) {
+pub fn init(i: &mut CoreIsolate, s: &Rc<State>) {
i.register_op("op_start", s.stateful_json_op(op_start));
i.register_op("op_main_module", s.stateful_json_op(op_main_module));
i.register_op("op_metrics", s.stateful_json_op(op_metrics));
}
fn op_start(
- state: &State,
+ state: &Rc<State>,
_args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<JsonOp, OpError> {
- let state = state.borrow();
let gs = &state.global_state;
Ok(JsonOp::Sync(json!({
@@ -43,11 +43,11 @@ fn op_start(
}
fn op_main_module(
- state: &State,
+ state: &Rc<State>,
_args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<JsonOp, OpError> {
- let main = &state.borrow().main_module.to_string();
+ let main = &state.main_module.to_string();
let main_url = ModuleSpecifier::resolve_url_or_path(&main)?;
if main_url.as_url().scheme() == "file" {
let main_path = std::env::current_dir().unwrap().join(main_url.to_string());
@@ -57,12 +57,11 @@ fn op_main_module(
}
fn op_metrics(
- state: &State,
+ state: &Rc<State>,
_args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<JsonOp, OpError> {
- let state = state.borrow();
- let m = &state.metrics;
+ let m = &state.metrics.borrow();
Ok(JsonOp::Sync(json!({
"opsDispatched": m.ops_dispatched,