Skip to content

Commit

Permalink
refactor(cli): exit with exit code 2 if reading from stdin fails
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed Aug 13, 2021
1 parent 08981fe commit 5911dff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cli/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ export { UpgradeCommand } from "https://deno.land/x/cliffy@v0.19.5/command/upgra
export { DenoLandProvider } from "https://deno.land/x/cliffy@v0.19.5/command/upgrade/provider/deno_land.ts";
export {
ValidationError,
} from "https://deno.land/x/cliffy@v0.19.5/flags/_errors.ts";
} from "https://deno.land/x/cliffy@v0.19.5/command/_errors.ts";
export { copy } from "https://deno.land/std@0.104.0/io/mod.ts";
4 changes: 1 addition & 3 deletions src/cli/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ export function dzx() {
$.mainModule = `data:application/typescript,${encodeURIComponent(data)}`;
await import($.mainModule);
} else {
// @TODO: add support for exit code in ValidationError
// throw new ValidationError(`Failed to read from stdin.`, 2);
throw new ValidationError(`Failed to read from stdin.`);
throw new ValidationError(`Failed to read from stdin.`, { exitCode: 2 });
}
}

Expand Down

0 comments on commit 5911dff

Please sign in to comment.