mirror of
https://github.com/denoland/deno.git
synced 2025-01-12 00:54:02 -05:00
fix(ext/node): use Deno.Command from ext:runtime
(#18289)
Fixes https://github.com/denoland/deno/issues/18281. This imports `Deno.Command` from `ext:runtime/40_process.js` instead of using `Deno[Deno.internal]?.nodeUnstable?.Command`.
This commit is contained in:
parent
aba5329aec
commit
d78db7c091
1 changed files with 3 additions and 6 deletions
|
@ -36,6 +36,7 @@ import {
|
||||||
} from "ext:deno_node/_next_tick.ts";
|
} from "ext:deno_node/_next_tick.ts";
|
||||||
import { isWindows } from "ext:deno_node/_util/os.ts";
|
import { isWindows } from "ext:deno_node/_util/os.ts";
|
||||||
import * as io from "ext:deno_io/12_io.js";
|
import * as io from "ext:deno_io/12_io.js";
|
||||||
|
import { Command } from "ext:runtime/40_process.js";
|
||||||
|
|
||||||
// TODO(kt3k): This should be set at start up time
|
// TODO(kt3k): This should be set at start up time
|
||||||
export let arch = "";
|
export let arch = "";
|
||||||
|
@ -61,10 +62,6 @@ import * as uv from "ext:deno_node/internal_binding/uv.ts";
|
||||||
import type { BindingName } from "ext:deno_node/internal_binding/mod.ts";
|
import type { BindingName } from "ext:deno_node/internal_binding/mod.ts";
|
||||||
import { buildAllowedFlags } from "ext:deno_node/internal/process/per_thread.mjs";
|
import { buildAllowedFlags } from "ext:deno_node/internal/process/per_thread.mjs";
|
||||||
|
|
||||||
// @ts-ignore Deno[Deno.internal] is used on purpose here
|
|
||||||
const DenoCommand = Deno[Deno.internal]?.nodeUnstable?.Command ||
|
|
||||||
Deno.Command;
|
|
||||||
|
|
||||||
const notImplementedEvents = [
|
const notImplementedEvents = [
|
||||||
"disconnect",
|
"disconnect",
|
||||||
"message",
|
"message",
|
||||||
|
@ -272,11 +269,11 @@ function _kill(pid: number, sig: number): number {
|
||||||
if (sig === 0) {
|
if (sig === 0) {
|
||||||
let status;
|
let status;
|
||||||
if (Deno.build.os === "windows") {
|
if (Deno.build.os === "windows") {
|
||||||
status = (new DenoCommand("powershell.exe", {
|
status = (new Command("powershell.exe", {
|
||||||
args: ["Get-Process", "-pid", pid],
|
args: ["Get-Process", "-pid", pid],
|
||||||
})).outputSync();
|
})).outputSync();
|
||||||
} else {
|
} else {
|
||||||
status = (new DenoCommand("kill", {
|
status = (new Command("kill", {
|
||||||
args: ["-0", pid],
|
args: ["-0", pid],
|
||||||
})).outputSync();
|
})).outputSync();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue