Skip to content

Commit

Permalink
feat: add $.prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed May 14, 2021
1 parent e6b91c9 commit 4ba75ac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ console.log(`Hello from ${$.blue.bold("worker")}!`);

- **$.shell:** Set the shell that is used by `` $`command` ``. Default:
`/bin/sh`
- **$.prefix:** Command prefix. Default: `set -euo pipefail;`.
- **$.mainModule:** The executed dzx script.
- **$.verbose:** Enable debugging output (log shell commands and execution
time).
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function exec(
const stderr: Array<string> = [];
const combined: Array<string> = [];
const process = Deno.run({
cmd: [$.shell, "-c", cmd],
cmd: [$.shell, "-c", $.prefix + " " + cmd],
env: Deno.env.toObject(),
stdout: $.stdout,
stderr: $.stderr,
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { quote } from "./quote.ts";

export type $ = typeof exec & typeof colors & {
shell: string;
prefix: string;
mainModule: string;
verbose: boolean;
stdout: NonNullable<Deno.RunOptions["stdout"]>;
Expand All @@ -22,6 +23,7 @@ Object.setPrototypeOf($, Object.getPrototypeOf(colors));

$._stack = [];
$.shell = "/bin/sh";
$.prefix = "set -euo pipefail;";
$.mainModule = "";
$.verbose = false;
$.stdout = "piped";
Expand Down

0 comments on commit 4ba75ac

Please sign in to comment.