From 0a82f3c0e96cb0f176e98663d5eb8dc251b191d2 Mon Sep 17 00:00:00 2001 From: Geert-Jan Zwiers Date: Thu, 1 Dec 2022 16:51:47 +0100 Subject: chore(tools): update deprecated commands in format and lint tool (#16864) Updates tools/format.js and tools/lint.js from Deno.spawn to Deno.Command API. --- tools/lint.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'tools/lint.js') diff --git a/tools/lint.js b/tools/lint.js index a9279bb25..baa1e9c3c 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -43,12 +43,14 @@ async function dlint() { const chunks = splitToChunks(sourceFiles, `${execPath} run`.length); for (const chunk of chunks) { - const { success } = await Deno.spawn(execPath, { + const cmd = new Deno.Command(execPath, { args: ["run", "--config=" + configFile, ...chunk], stdout: "inherit", stderr: "inherit", }); - if (!success) { + const { code } = await cmd.output(); + + if (code > 0) { throw new Error("dlint failed"); } } @@ -74,12 +76,14 @@ async function dlintPreferPrimordials() { const chunks = splitToChunks(sourceFiles, `${execPath} run`.length); for (const chunk of chunks) { - const { success } = await Deno.spawn(execPath, { + const cmd = new Deno.Command(execPath, { args: ["run", "--rule", "prefer-primordials", ...chunk], stdout: "inherit", stderr: "inherit", }); - if (!success) { + const { code } = await cmd.output(); + + if (code > 0) { throw new Error("prefer-primordials failed"); } } @@ -111,7 +115,7 @@ async function clippy() { cmd.push("--release"); } - const { success } = await Deno.spawn("cargo", { + const cargoCmd = new Deno.Command("cargo", { args: [ ...cmd, "--", @@ -121,7 +125,9 @@ async function clippy() { stdout: "inherit", stderr: "inherit", }); - if (!success) { + const { code } = await cargoCmd.output(); + + if (code > 0) { throw new Error("clippy failed"); } } -- cgit v1.2.3