1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-24 08:09:08 -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:
Geert-Jan Zwiers 2023-03-20 14:24:43 +01:00 committed by GitHub
parent aba5329aec
commit d78db7c091
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,6 +36,7 @@ import {
} from "ext:deno_node/_next_tick.ts";
import { isWindows } from "ext:deno_node/_util/os.ts";
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
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 { 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 = [
"disconnect",
"message",
@ -272,11 +269,11 @@ function _kill(pid: number, sig: number): number {
if (sig === 0) {
let status;
if (Deno.build.os === "windows") {
status = (new DenoCommand("powershell.exe", {
status = (new Command("powershell.exe", {
args: ["Get-Process", "-pid", pid],
})).outputSync();
} else {
status = (new DenoCommand("kill", {
status = (new Command("kill", {
args: ["-0", pid],
})).outputSync();
}