Skip to content

Commit

Permalink
fixed Deno.Command usage
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Apr 29, 2023
1 parent 2d9312b commit 9c1034e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default async function main(args: string[]) {
checkDenoVersion();

const [lumeArgs, denoArgs] = await getArgs(args, quiet);
const { code } = new Deno.Command(Deno.execPath(), {
const { success } = new Deno.Command(Deno.execPath(), {
args: [
"run",
...denoArgs,
Expand All @@ -66,7 +66,7 @@ export default async function main(args: string[]) {
stderr: "inherit",
}).outputSync();

if (code !== 0) {
if (!success) {
addEventListener("unload", () => Deno.exit(1));
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class Scripts {
});

const output = await command.output();
return output.code === 0;
return output.success;
}
}

Expand Down
4 changes: 2 additions & 2 deletions core/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,9 @@ export function getGitDate(
? ["log", "--diff-filter=A", "--follow", "-1", "--format=%at", "--", file]
: ["log", "-1", "--format=%at", "--", file];

const { code, stdout } = new Deno.Command("git", { args }).outputSync();
const { stdout, success } = new Deno.Command("git", { args }).outputSync();

if (code !== 0) {
if (!success) {
return;
}
const str = new TextDecoder().decode(stdout);
Expand Down
3 changes: 1 addition & 2 deletions tests/core/scripts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Logger from "../../core/logger.ts";
Deno.test("Scripts", async (t) => {
const scripts = new Scripts({
logger: new Logger({ quiet: true }),
options: {},
});

equals(scripts.scripts.size, 0);
Expand Down Expand Up @@ -46,7 +45,7 @@ Deno.test("Scripts", async (t) => {
scripts.set("my-false-fn", () => false);

equals(scripts.scripts.size, 5);
const result = await scripts.run({}, "my-false-fn");
const result = await scripts.run("my-false-fn");
equals(result, false);
});
});

0 comments on commit 9c1034e

Please sign in to comment.