diff options
author | Leo Kettmeir <crowlkats@toaxl.com> | 2022-05-18 22:00:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-18 22:00:11 +0200 |
commit | 4e1ca1d1787f25ab9f0a72ccf9d8028f70b3a7ed (patch) | |
tree | 2d0062ec1dd864c7ed98301119ac5f1c133f844a /tools/format.js | |
parent | 5ad8919d642b646caa3328930dd1a3f290bc587e (diff) |
refactor: use spawn API across codebase (#14414)
Diffstat (limited to 'tools/format.js')
-rwxr-xr-x | tools/format.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/tools/format.js b/tools/format.js index a829c86dd..2cd90f622 100755 --- a/tools/format.js +++ b/tools/format.js @@ -5,14 +5,14 @@ import { getPrebuiltToolPath, join, ROOT_PATH } from "./util.js"; async function dprint() { const configFile = join(ROOT_PATH, ".dprint.json"); const execPath = getPrebuiltToolPath("dprint"); - const p = Deno.run({ - cmd: [execPath, "fmt", "--config=" + configFile], + const { status } = await Deno.spawn(execPath, { + args: ["fmt", "--config=" + configFile], + stdout: "inherit", + stderr: "inherit", }); - const { success } = await p.status(); - if (!success) { + if (!status.success) { throw new Error("dprint failed"); } - p.close(); } async function main() { @@ -20,17 +20,15 @@ async function main() { await dprint(); if (Deno.args.includes("--check")) { - const git = Deno.run({ - cmd: ["git", "status", "-uno", "--porcelain", "--ignore-submodules"], - stdout: "piped", + const { status, stdout } = await Deno.spawn("git", { + args: ["status", "-uno", "--porcelain", "--ignore-submodules"], + stderr: "inherit", }); - const { success } = await git.status(); - if (!success) { + if (!status.success) { throw new Error("git status failed"); } - const out = new TextDecoder().decode(await git.output()); - git.close(); + const out = new TextDecoder().decode(stdout); if (out) { console.log("run tools/format.js"); |