summaryrefslogtreecommitdiff
path: root/runtime/js/40_process.js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js/40_process.js')
-rw-r--r--runtime/js/40_process.js29
1 files changed, 17 insertions, 12 deletions
diff --git a/runtime/js/40_process.js b/runtime/js/40_process.js
index 24ae65ab6..c90f38664 100644
--- a/runtime/js/40_process.js
+++ b/runtime/js/40_process.js
@@ -1,7 +1,15 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { core, internals, primordials } from "ext:core/mod.js";
-const ops = core.ops;
+const {
+ op_kill,
+ op_run,
+ op_run_status,
+ op_spawn_child,
+ op_spawn_kill,
+ op_spawn_sync,
+ op_spawn_wait,
+} = core.ensureFastOps();
const {
ArrayPrototypeMap,
ArrayPrototypeSlice,
@@ -14,6 +22,7 @@ const {
SafePromiseAll,
Symbol,
} = primordials;
+
import { FsFile } from "ext:deno_fs/30_fs.js";
import { readAll } from "ext:deno_io/12_io.js";
import {
@@ -30,13 +39,9 @@ import {
ReadableStreamPrototype,
writableStreamForRid,
} from "ext:deno_web/06_streams.js";
-const {
- op_run_status,
- op_spawn_wait,
-} = core.ensureFastOps();
function opKill(pid, signo, apiName) {
- ops.op_kill(pid, signo, apiName);
+ op_kill(pid, signo, apiName);
}
function kill(pid, signo = "SIGTERM") {
@@ -49,7 +54,7 @@ function opRunStatus(rid) {
function opRun(request) {
assert(request.cmd.length > 0);
- return ops.op_run(request);
+ return op_run(request);
}
async function runStatus(rid) {
@@ -187,7 +192,7 @@ function spawnChildInner(opFn, command, apiName, {
function spawnChild(command, options = {}) {
return spawnChildInner(
- ops.op_spawn_child,
+ op_spawn_child,
command,
"Deno.Command().spawn()",
options,
@@ -331,12 +336,12 @@ class ChildProcess {
if (this.#waitComplete) {
throw new TypeError("Child process has already terminated.");
}
- ops.op_spawn_kill(this.#rid, signo);
+ op_spawn_kill(this.#rid, signo);
}
async [SymbolAsyncDispose]() {
try {
- ops.op_spawn_kill(this.#rid, "SIGTERM");
+ op_spawn_kill(this.#rid, "SIGTERM");
} catch {
// ignore errors from killing the process (such as ESRCH or BadResource)
}
@@ -363,7 +368,7 @@ function spawn(command, options) {
);
}
return spawnChildInner(
- ops.op_spawn_child,
+ op_spawn_child,
command,
"Deno.Command().output()",
options,
@@ -388,7 +393,7 @@ function spawnSync(command, {
"Piped stdin is not supported for this function, use 'Deno.Command().spawn()' instead",
);
}
- const result = ops.op_spawn_sync({
+ const result = op_spawn_sync({
cmd: pathFromURL(command),
args: ArrayPrototypeMap(args, String),
cwd: pathFromURL(cwd),