Skip to content

Commit

Permalink
Improve bun shell docs examples (#10052)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavbls authored Apr 8, 2024
1 parent ad6aadf commit 9898e0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/runtime/shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ console.log(stderr);
The default handling of non-zero exit codes can be configured by calling `.nothrow()` or `.throws(boolean)` on the `$` function itself.

```js
import { $ } from "bun";
// shell promises will not throw, meaning you will have to
// check for `exitCode` manually on every shell command.
$.nothrow(); // equivilent to $.throws(false)
Expand All @@ -108,6 +109,8 @@ $.throws(true);

// alias for $.nothrow()
$.throws(false);

await $`something-that-may-fail`; // No exception thrown
```

## Redirection
Expand Down Expand Up @@ -149,7 +152,7 @@ The following JavaScript objects are supported for redirection to:
To redirect the output from JavaScript objects to stdin, use the `<` operator:

```js
import { $, file } from "bun";
import { $ } from "bun";

const response = new Response("hello i am a response body");

Expand Down
2 changes: 1 addition & 1 deletion test/js/bun/shell/bunshell-file.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { $, file } from "bun";
import { $ } from "bun";
import { test, expect } from "bun:test";

test("$ with Bun.file prints the path", async () => {
Expand Down

0 comments on commit 9898e0a

Please sign in to comment.