1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

BREAKING(types): soft-remove Deno.run() (#25403)

Towards #22079
This commit is contained in:
Asher Gomez 2024-09-05 08:45:55 +10:00 committed by GitHub
parent c32d692a8f
commit 195b17ae12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 58 additions and 368 deletions

View file

@ -3925,175 +3925,6 @@ declare namespace Deno {
options?: { recursive: boolean },
): FsWatcher;
/**
* Options which can be used with {@linkcode Deno.run}.
*
* @deprecated This will be removed in Deno 2.0. See the
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
* for migration instructions.
*
* @category Subprocess */
export interface RunOptions {
/** Arguments to pass.
*
* _Note_: the first element needs to be a path to the executable that is
* being run. */
cmd: readonly string[] | [string | URL, ...string[]];
/** The current working directory that should be used when running the
* sub-process. */
cwd?: string;
/** Any environment variables to be set when running the sub-process. */
env?: Record<string, string>;
/** By default subprocess inherits `stdout` of parent process. To change
* this this option can be set to a resource ID (_rid_) of an open file,
* `"inherit"`, `"piped"`, or `"null"`:
*
* - _number_: the resource ID of an open file/resource. This allows you to
* write to a file.
* - `"inherit"`: The default if unspecified. The subprocess inherits from the
* parent.
* - `"piped"`: A new pipe should be arranged to connect the parent and child
* sub-process.
* - `"null"`: This stream will be ignored. This is the equivalent of attaching
* the stream to `/dev/null`.
*/
stdout?: "inherit" | "piped" | "null" | number;
/** By default subprocess inherits `stderr` of parent process. To change
* this this option can be set to a resource ID (_rid_) of an open file,
* `"inherit"`, `"piped"`, or `"null"`:
*
* - _number_: the resource ID of an open file/resource. This allows you to
* write to a file.
* - `"inherit"`: The default if unspecified. The subprocess inherits from the
* parent.
* - `"piped"`: A new pipe should be arranged to connect the parent and child
* sub-process.
* - `"null"`: This stream will be ignored. This is the equivalent of attaching
* the stream to `/dev/null`.
*/
stderr?: "inherit" | "piped" | "null" | number;
/** By default subprocess inherits `stdin` of parent process. To change
* this this option can be set to a resource ID (_rid_) of an open file,
* `"inherit"`, `"piped"`, or `"null"`:
*
* - _number_: the resource ID of an open file/resource. This allows you to
* read from a file.
* - `"inherit"`: The default if unspecified. The subprocess inherits from the
* parent.
* - `"piped"`: A new pipe should be arranged to connect the parent and child
* sub-process.
* - `"null"`: This stream will be ignored. This is the equivalent of attaching
* the stream to `/dev/null`.
*/
stdin?: "inherit" | "piped" | "null" | number;
}
/**
* The status resolved from the `.status()` method of a
* {@linkcode Deno.Process} instance.
*
* If `success` is `true`, then `code` will be `0`, but if `success` is
* `false`, the sub-process exit code will be set in `code`.
*
* @deprecated This will be removed in Deno 2.0. See the
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
* for migration instructions.
*
* @category Subprocess */
export type ProcessStatus =
| {
success: true;
code: 0;
signal?: undefined;
}
| {
success: false;
code: number;
signal?: number;
};
/**
* Represents an instance of a sub process that is returned from
* {@linkcode Deno.run} which can be used to manage the sub-process.
*
* @deprecated This will be removed in Deno 2.0. See the
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
* for migration instructions.
*
* @category Subprocess */
export class Process<T extends RunOptions = RunOptions> {
/** The resource ID of the sub-process. */
readonly rid: number;
/** The operating system's process ID for the sub-process. */
readonly pid: number;
/** A reference to the sub-processes `stdin`, which allows interacting with
* the sub-process at a low level. */
readonly stdin: T["stdin"] extends "piped" ? Writer & Closer & {
writable: WritableStream<Uint8Array>;
}
: (Writer & Closer & { writable: WritableStream<Uint8Array> }) | null;
/** A reference to the sub-processes `stdout`, which allows interacting with
* the sub-process at a low level. */
readonly stdout: T["stdout"] extends "piped" ? Reader & Closer & {
readable: ReadableStream<Uint8Array>;
}
: (Reader & Closer & { readable: ReadableStream<Uint8Array> }) | null;
/** A reference to the sub-processes `stderr`, which allows interacting with
* the sub-process at a low level. */
readonly stderr: T["stderr"] extends "piped" ? Reader & Closer & {
readable: ReadableStream<Uint8Array>;
}
: (Reader & Closer & { readable: ReadableStream<Uint8Array> }) | null;
/** Wait for the process to exit and return its exit status.
*
* Calling this function multiple times will return the same status.
*
* The `stdin` reference to the process will be closed before waiting to
* avoid a deadlock.
*
* If `stdout` and/or `stderr` were set to `"piped"`, they must be closed
* manually before the process can exit.
*
* To run process to completion and collect output from both `stdout` and
* `stderr` use:
*
* ```ts
* const p = Deno.run({ cmd: [ "echo", "hello world" ], stderr: 'piped', stdout: 'piped' });
* const [status, stdout, stderr] = await Promise.all([
* p.status(),
* p.output(),
* p.stderrOutput()
* ]);
* p.close();
* ```
*/
status(): Promise<ProcessStatus>;
/** Buffer the stdout until EOF and return it as `Uint8Array`.
*
* You must set `stdout` to `"piped"` when creating the process.
*
* This calls `close()` on stdout after its done. */
output(): Promise<Uint8Array>;
/** Buffer the stderr until EOF and return it as `Uint8Array`.
*
* You must set `stderr` to `"piped"` when creating the process.
*
* This calls `close()` on stderr after its done. */
stderrOutput(): Promise<Uint8Array>;
/** Clean up resources associated with the sub-process instance. */
close(): void;
/** Send a signal to process.
* Default signal is `"SIGTERM"`.
*
* ```ts
* const p = Deno.run({ cmd: [ "sleep", "20" ]});
* p.kill("SIGTERM");
* p.close();
* ```
*/
kill(signo?: Signal): void;
}
/** Operating signals which can be listened for or sent to sub-processes. What
* signals and what their standard behaviors are OS dependent.
*
@ -4175,61 +4006,6 @@ declare namespace Deno {
handler: () => void,
): void;
/**
* Spawns new subprocess. RunOptions must contain at a minimum the `opt.cmd`,
* an array of program arguments, the first of which is the binary.
*
* ```ts
* const p = Deno.run({
* cmd: ["curl", "https://example.com"],
* });
* const status = await p.status();
* ```
*
* Subprocess uses same working directory as parent process unless `opt.cwd`
* is specified.
*
* Environmental variables from parent process can be cleared using `opt.clearEnv`.
* Doesn't guarantee that only `opt.env` variables are present,
* as the OS may set environmental variables for processes.
*
* Environmental variables for subprocess can be specified using `opt.env`
* mapping.
*
* `opt.uid` sets the child processs user ID. This translates to a setuid call
* in the child process. Failure in the setuid call will cause the spawn to fail.
*
* `opt.gid` is similar to `opt.uid`, but sets the group ID of the child process.
* This has the same semantics as the uid field.
*
* By default subprocess inherits stdio of parent process. To change
* this this, `opt.stdin`, `opt.stdout`, and `opt.stderr` can be set
* independently to a resource ID (_rid_) of an open file, `"inherit"`,
* `"piped"`, or `"null"`:
*
* - _number_: the resource ID of an open file/resource. This allows you to
* read or write to a file.
* - `"inherit"`: The default if unspecified. The subprocess inherits from the
* parent.
* - `"piped"`: A new pipe should be arranged to connect the parent and child
* sub-process.
* - `"null"`: This stream will be ignored. This is the equivalent of attaching
* the stream to `/dev/null`.
*
* Details of the spawned process are returned as an instance of
* {@linkcode Deno.Process}.
*
* Requires `allow-run` permission.
*
* @deprecated This will be soft-removed in Deno 2.0. See the
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
* for migration instructions.
*
* @tags allow-run
* @category Subprocess
*/
export function run<T extends RunOptions = RunOptions>(opt: T): Process<T>;
/** Create a child process.
*
* If any stdio options are not set to `"piped"`, accessing the corresponding
@ -5308,11 +5084,10 @@ declare namespace Deno {
* Windows.
*
* ```ts
* const p = Deno.run({
* cmd: ["sleep", "10000"]
* });
* const command = new Deno.Command("sleep", { args: ["10000"] });
* const child = command.spawn();
*
* Deno.kill(p.pid, "SIGINT");
* Deno.kill(child.pid, "SIGINT");
* ```
*
* Requires `allow-run` permission.

View file

@ -840,80 +840,6 @@ declare namespace Deno {
present(): void;
}
/** **UNSTABLE**: New API, yet to be vetted.
*
* These are unstable options which can be used with {@linkcode Deno.run}.
*
* @category Subprocess
* @experimental
*/
export interface UnstableRunOptions extends RunOptions {
/** If `true`, clears the environment variables before executing the
* sub-process.
*
* @default {false} */
clearEnv?: boolean;
/** For POSIX systems, sets the group ID for the sub process. */
gid?: number;
/** For POSIX systems, sets the user ID for the sub process. */
uid?: number;
}
/** **UNSTABLE**: New API, yet to be vetted.
*
* Spawns new subprocess. RunOptions must contain at a minimum the `opt.cmd`,
* an array of program arguments, the first of which is the binary.
*
* ```ts
* const p = Deno.run({
* cmd: ["curl", "https://example.com"],
* });
* const status = await p.status();
* ```
*
* Subprocess uses same working directory as parent process unless `opt.cwd`
* is specified.
*
* Environmental variables from parent process can be cleared using `opt.clearEnv`.
* Doesn't guarantee that only `opt.env` variables are present,
* as the OS may set environmental variables for processes.
*
* Environmental variables for subprocess can be specified using `opt.env`
* mapping.
*
* `opt.uid` sets the child processs user ID. This translates to a setuid call
* in the child process. Failure in the setuid call will cause the spawn to fail.
*
* `opt.gid` is similar to `opt.uid`, but sets the group ID of the child process.
* This has the same semantics as the uid field.
*
* By default subprocess inherits stdio of parent process. To change
* this this, `opt.stdin`, `opt.stdout`, and `opt.stderr` can be set
* independently to a resource ID (_rid_) of an open file, `"inherit"`,
* `"piped"`, or `"null"`:
*
* - _number_: the resource ID of an open file/resource. This allows you to
* read or write to a file.
* - `"inherit"`: The default if unspecified. The subprocess inherits from the
* parent.
* - `"piped"`: A new pipe should be arranged to connect the parent and child
* sub-process.
* - `"null"`: This stream will be ignored. This is the equivalent of attaching
* the stream to `/dev/null`.
*
* Details of the spawned process are returned as an instance of
* {@linkcode Deno.Process}.
*
* Requires `allow-run` permission.
*
* @tags allow-run
* @category Subprocess
* @experimental
*/
export function run<T extends UnstableRunOptions = UnstableRunOptions>(
opt: T,
): Process<T>;
/** **UNSTABLE**: New API, yet to be vetted.
*
* A custom `HttpClient` for use with {@linkcode fetch} function. This is

View file

@ -130,6 +130,8 @@ class Process {
}
}
// Note: This function was soft-removed in Deno 2. Its types have been removed,
// but its implementation has been kept to avoid breaking changes.
function run({
cmd,
cwd = undefined,
@ -144,11 +146,6 @@ function run({
...new SafeArrayIterator(ArrayPrototypeSlice(cmd, 1)),
];
}
internals.warnOnDeprecatedApi(
"Deno.run()",
(new Error()).stack,
`Use "Deno.Command()" API instead.`,
);
const res = opRun({
cmd: ArrayPrototypeMap(cmd, String),
cwd,

View file

@ -7,32 +7,29 @@ Deno.test("complex", function () {
Deno.test("sub process with stdin", async () => {
// ensure launching deno run with stdin doesn't affect coverage
const code = "console.log('5')";
// deno-lint-ignore no-deprecated-deno-api
const p = await Deno.run({
cmd: [Deno.execPath(), "run", "-"],
const command = new Deno.Command(Deno.execPath(), {
args: ["run", "-"],
stdin: "piped",
stdout: "piped",
});
const encoder = new TextEncoder();
await p.stdin.write(encoder.encode(code));
await p.stdin.close();
const output = new TextDecoder().decode(await p.output());
p.close();
await using child = command.spawn();
await ReadableStream.from([code])
.pipeThrough(new TextEncoderStream())
.pipeTo(child.stdin);
const { stdout } = await child.output();
const output = new TextDecoder().decode(stdout);
if (output.trim() !== "5") {
throw new Error("Failed");
}
});
Deno.test("sub process with deno eval", async () => {
Deno.test("sub process with deno eval", () => {
// ensure launching deno eval doesn't affect coverage
const code = "console.log('5')";
// deno-lint-ignore no-deprecated-deno-api
const p = await Deno.run({
cmd: [Deno.execPath(), "eval", code],
stdout: "piped",
});
const output = new TextDecoder().decode(await p.output());
p.close();
const { stdout } = new Deno.Command(Deno.execPath(), {
args: ["eval", code],
}).outputSync();
const output = new TextDecoder().decode(stdout);
if (output.trim() !== "5") {
throw new Error("Failed");
}

View file

@ -1,5 +1,6 @@
import { runEcho as runEcho2 } from "http://localhost:4545/run/warn_on_deprecated_api/mod.ts";
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -11,6 +12,7 @@ await p.status();
p.close();
async function runEcho() {
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),

View file

@ -1,5 +1,4 @@
Download http://localhost:4545/run/warn_on_deprecated_api/mod.ts
warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.
hello world
hello world
hello world

View file

@ -1,5 +1,4 @@
Download http://localhost:4545/run/warn_on_deprecated_api/mod.ts
warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
See the Deno 1 to 2 Migration Guide for more information at https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
@ -9,7 +8,6 @@ Stack trace:
hint: Use "Deno.Command()" API instead.
hello world
warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
See the Deno 1 to 2 Migration Guide for more information at https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
@ -20,7 +18,6 @@ Stack trace:
hint: Use "Deno.Command()" API instead.
hello world
warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
See the Deno 1 to 2 Migration Guide for more information at https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
@ -31,7 +28,6 @@ Stack trace:
hint: Use "Deno.Command()" API instead.
hello world
warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
See the Deno 1 to 2 Migration Guide for more information at https://docs.deno.com/runtime/manual/advanced/migrate_deprecations
@ -51,7 +47,6 @@ hello world
hello world
hello world
hello world
warning: Use of deprecated "Deno.run()" API. This API will be removed in Deno 2.
See the Deno 1 to 2 Migration Guide for more information at https://docs.deno.com/runtime/manual/advanced/migrate_deprecations

View file

@ -2087,7 +2087,6 @@ Deno.test({
async function client() {
const url = `http://${hostname}:${port}/`;
const cmd = [
"curl",
"-i",
"--request",
"GET",
@ -2097,16 +2096,17 @@ Deno.test({
"--header",
"Accept-Encoding: deflate, gzip",
];
const proc = Deno.run({ cmd, stdout: "piped", stderr: "null" });
const status = await proc.status();
assert(status.success);
const output = decoder.decode(await proc.output());
const { success, stdout } = await new Deno.Command("curl", {
args: cmd,
stderr: "null",
}).output();
assert(success);
const output = decoder.decode(stdout);
assert(output.includes("vary: Accept-Encoding\r\n"));
assert(output.includes("content-encoding: gzip\r\n"));
// Ensure the content-length header is updated.
assert(!output.includes(`content-length: ${contentLength}\r\n`));
assert(output.includes("content-length: "));
proc.close();
}
await Promise.all([server(), client()]);
@ -2149,7 +2149,6 @@ Deno.test({
async function client() {
const url = `http://${hostname}:${port}/`;
const cmd = [
"curl",
"-i",
"--request",
"GET",
@ -2159,13 +2158,15 @@ Deno.test({
"--header",
"Accept-Encoding: deflate, gzip",
];
const proc = Deno.run({ cmd, stdout: "piped", stderr: "null" });
const status = await proc.status();
assert(status.success);
const output = decoder.decode(await proc.output());
const { success, stdout } = await new Deno.Command("curl", {
args: cmd,
stderr: "null",
stdout: "piped",
}).output();
assert(success);
const output = decoder.decode(stdout);
assert(output.includes("vary: Accept-Encoding\r\n"));
assert(output.includes("content-encoding: arbitrary\r\n"));
proc.close();
}
await Promise.all([server(), client()]);

View file

@ -1,3 +1,4 @@
// deno-lint-ignore-file no-deprecated-deno-api
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import {
assert,
@ -12,7 +13,7 @@ Deno.test(
{ permissions: { read: true, run: false } },
function runPermissions() {
assertThrows(() => {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
});
@ -23,7 +24,7 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runSuccess() {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
// freeze the array to ensure it's not modified
cmd: Object.freeze([
@ -46,7 +47,7 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runUrl() {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
new URL(`file:///${Deno.execPath()}`),
@ -70,7 +71,7 @@ Deno.test(
async function runStdinRid0(): Promise<
void
> {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
stdin: 0,
@ -90,26 +91,23 @@ Deno.test(
{ permissions: { run: true, read: true } },
function runInvalidStdio() {
assertThrows(() =>
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
// @ts-expect-error because Deno.run should throw on invalid stdin.
stdin: "a",
})
);
assertThrows(() =>
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
// @ts-expect-error because Deno.run should throw on invalid stdout.
stdout: "b",
})
);
assertThrows(() =>
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
Deno.run({
cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
// @ts-expect-error because Deno.run should throw on invalid stderr.
stderr: "c",
})
);
@ -119,7 +117,7 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runCommandFailedWithCode() {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [Deno.execPath(), "eval", "Deno.exit(41 + 1)"],
});
@ -136,7 +134,7 @@ Deno.test(
permissions: { run: true, read: true },
},
async function runCommandFailedWithSignal() {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -160,7 +158,7 @@ Deno.test(
Deno.test({ permissions: { run: true } }, function runNotFound() {
let error;
try {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
Deno.run({ cmd: ["this file hopefully doesn't exist"] });
} catch (e) {
error = e;
@ -192,7 +190,7 @@ tryExit();
`;
Deno.writeFileSync(`${cwd}/${programFile}`, enc.encode(program));
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cwd,
cmd: [Deno.execPath(), "run", "--allow-read", programFile],
@ -216,7 +214,7 @@ Deno.test(
async function runStdinPiped(): Promise<
void
> {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -254,7 +252,7 @@ Deno.test(
async function runStdoutPiped(): Promise<
void
> {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -291,7 +289,7 @@ Deno.test(
async function runStderrPiped(): Promise<
void
> {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -326,7 +324,7 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runOutput() {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -347,7 +345,7 @@ Deno.test(
async function runStderrOutput(): Promise<
void
> {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -377,7 +375,7 @@ Deno.test(
write: true,
});
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -414,7 +412,7 @@ Deno.test(
await Deno.writeTextFile(fileName, "hello");
using file = await Deno.open(fileName);
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -439,7 +437,7 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runEnv() {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -462,7 +460,7 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runClose() {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),
@ -486,7 +484,7 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function runKillAfterStatus() {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [Deno.execPath(), "eval", 'console.log("hello")'],
});
@ -543,7 +541,7 @@ Deno.test(
Deno.test(
{ permissions: { run: true, read: true } },
async function killSuccess() {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [Deno.execPath(), "eval", "setTimeout(() => {}, 10000)"],
});
@ -567,7 +565,7 @@ Deno.test(
);
Deno.test({ permissions: { run: true, read: true } }, function killFailed() {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [Deno.execPath(), "eval", "setTimeout(() => {}, 10000)"],
});
@ -588,7 +586,7 @@ Deno.test(
ignore: Deno.build.os === "windows",
},
async function non_existent_cwd(): Promise<void> {
// deno-lint-ignore no-deprecated-deno-api
// @ts-ignore `Deno.run()` was soft-removed in Deno 2.
const p = Deno.run({
cmd: [
Deno.execPath(),