diff options
author | Satya Rohith <me@satyarohith.com> | 2022-07-21 14:15:15 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-21 14:15:15 +0530 |
commit | e98e0da8b218aa2b68d82ee7d777f499b10237aa (patch) | |
tree | 05cc660c005c35bdc27a4f37be295a0f06a3ccee | |
parent | f0e01682cce638303e3b6997788667a0f71dff8d (diff) |
fix(tools): upgrade to new `Deno.spawn` api (#15265)
-rwxr-xr-x | tools/flamebench.js | 10 | ||||
-rwxr-xr-x | tools/format.js | 8 | ||||
-rwxr-xr-x | tools/lint.js | 12 | ||||
-rw-r--r-- | tools/util.js | 4 | ||||
-rwxr-xr-x | tools/wgpu_sync.js | 6 | ||||
-rw-r--r-- | tools/wpt/utils.ts | 8 |
6 files changed, 24 insertions, 24 deletions
diff --git a/tools/flamebench.js b/tools/flamebench.js index 5293fa9a1..54705d266 100755 --- a/tools/flamebench.js +++ b/tools/flamebench.js @@ -3,14 +3,14 @@ import { join, ROOT_PATH as ROOT } from "./util.js"; async function bashOut(subcmd) { - const { status, stdout } = await Deno.spawn("bash", { + const { success, stdout } = await Deno.spawn("bash", { args: ["-c", subcmd], stdout: "piped", stderr: "null", }); // Check for failure - if (!status.success) { + if (!success) { throw new Error("subcmd failed"); } // Gather output @@ -20,7 +20,7 @@ async function bashOut(subcmd) { } async function bashThrough(subcmd, opts = {}) { - const { status } = await Deno.spawn("bash", { + const { success, code } = await Deno.spawn("bash", { ...opts, args: ["-c", subcmd], stdout: "inherit", @@ -28,8 +28,8 @@ async function bashThrough(subcmd, opts = {}) { }); // Exit process on failure - if (!status.success) { - Deno.exit(status.code); + if (!success) { + Deno.exit(code); } } diff --git a/tools/format.js b/tools/format.js index 2cd90f622..fe18352f3 100755 --- a/tools/format.js +++ b/tools/format.js @@ -5,12 +5,12 @@ import { getPrebuiltToolPath, join, ROOT_PATH } from "./util.js"; async function dprint() { const configFile = join(ROOT_PATH, ".dprint.json"); const execPath = getPrebuiltToolPath("dprint"); - const { status } = await Deno.spawn(execPath, { + const { success } = await Deno.spawn(execPath, { args: ["fmt", "--config=" + configFile], stdout: "inherit", stderr: "inherit", }); - if (!status.success) { + if (!success) { throw new Error("dprint failed"); } } @@ -20,12 +20,12 @@ async function main() { await dprint(); if (Deno.args.includes("--check")) { - const { status, stdout } = await Deno.spawn("git", { + const { success, stdout } = await Deno.spawn("git", { args: ["status", "-uno", "--porcelain", "--ignore-submodules"], stderr: "inherit", }); - if (!status.success) { + if (!success) { throw new Error("git status failed"); } const out = new TextDecoder().decode(stdout); diff --git a/tools/lint.js b/tools/lint.js index f1fa96a2c..ee438ed8b 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -40,12 +40,12 @@ async function dlint() { const chunks = splitToChunks(sourceFiles, `${execPath} run`.length); for (const chunk of chunks) { - const { status } = await Deno.spawn(execPath, { + const { success } = await Deno.spawn(execPath, { args: ["run", "--config=" + configFile, ...chunk], stdout: "inherit", stderr: "inherit", }); - if (!status.success) { + if (!success) { throw new Error("dlint failed"); } } @@ -71,12 +71,12 @@ async function dlintPreferPrimordials() { const chunks = splitToChunks(sourceFiles, `${execPath} run`.length); for (const chunk of chunks) { - const { status } = await Deno.spawn(execPath, { + const { success } = await Deno.spawn(execPath, { args: ["run", "--rule", "prefer-primordials", ...chunk], stdout: "inherit", stderr: "inherit", }); - if (!status.success) { + if (!success) { throw new Error("prefer-primordials failed"); } } @@ -108,7 +108,7 @@ async function clippy() { cmd.push("--release"); } - const { status } = await Deno.spawn("cargo", { + const { success } = await Deno.spawn("cargo", { args: [ ...cmd, "--", @@ -124,7 +124,7 @@ async function clippy() { stdout: "inherit", stderr: "inherit", }); - if (!status.success) { + if (!success) { throw new Error("clippy failed"); } } diff --git a/tools/util.js b/tools/util.js index c76456b9a..d164ca954 100644 --- a/tools/util.js +++ b/tools/util.js @@ -14,12 +14,12 @@ export { delay } from "../test_util/std/async/delay.ts"; export const ROOT_PATH = dirname(dirname(fromFileUrl(import.meta.url))); async function getFilesFromGit(baseDir, args) { - const { status, stdout } = await Deno.spawn("git", { + const { success, stdout } = await Deno.spawn("git", { stderr: "inherit", args, }); const output = new TextDecoder().decode(stdout); - if (!status.success) { + if (!success) { throw new Error("gitLsFiles failed"); } diff --git a/tools/wgpu_sync.js b/tools/wgpu_sync.js index eda5c5e18..06dbe7381 100755 --- a/tools/wgpu_sync.js +++ b/tools/wgpu_sync.js @@ -9,7 +9,7 @@ const V_WGPU = "0.13"; const TARGET_DIR = join(ROOT_PATH, "ext", "webgpu"); async function bash(subcmd, opts = {}) { - const { status } = await Deno.spawn("bash", { + const { success, code } = await Deno.spawn("bash", { ...opts, args: ["-c", subcmd], stdout: "inherit", @@ -17,8 +17,8 @@ async function bash(subcmd, opts = {}) { }); // Exit process on failure - if (!status.success) { - Deno.exit(status.code); + if (!success) { + Deno.exit(code); } } diff --git a/tools/wpt/utils.ts b/tools/wpt/utils.ts index 80580928c..c77effa62 100644 --- a/tools/wpt/utils.ts +++ b/tools/wpt/utils.ts @@ -133,10 +133,10 @@ export function runPy<T extends Omit<Deno.SpawnOptions, "cwd">>( } export async function checkPy3Available() { - const { status, stdout } = await runPy(["--version"], { + const { success, stdout } = await runPy(["--version"], { stdout: "piped", }).output(); - assert(status.success, "failed to run python --version"); + assert(success, "failed to run python --version"); const output = new TextDecoder().decode(stdout); assert( output.includes("Python 3."), @@ -148,13 +148,13 @@ export async function checkPy3Available() { export async function cargoBuild() { if (binary) return; - const { status } = await Deno.spawn("cargo", { + const { success } = await Deno.spawn("cargo", { args: ["build", ...(release ? ["--release"] : [])], cwd: ROOT_PATH, stdout: "inherit", stderr: "inherit", }); - assert(status.success, "cargo build failed"); + assert(success, "cargo build failed"); } export function escapeLoneSurrogates(input: string): string; |