Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
j50n committed Feb 11, 2022
1 parent 4d43230 commit 24a0414
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
28 changes: 19 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,31 @@ fully consumed), you can use the short form safely.

### Direct Control Over `stderr`

For most of the output handlers, the first argument is optional and allows you to pass a function to process `stderr` yourself.
For most of the output handlers, the first argument is optional and allows you
to pass a function to process `stderr` yourself.

- The function is passed one argument - an `AsyncIterator<string>` of `stderr` lines in text form (unbuffered)
- You can optionally return a `string[]` of lines from this function; these are attached to the `ProcessExitError` if the process returns a non-zero error code
- You can throw an error from this function; this allows you to scrape `stderr` and do special error handling
- The function is passed one argument - an `AsyncIterator<string>` of `stderr`
lines in text form (unbuffered)
- You can optionally return a `string[]` of lines from this function; these are
attached to the `ProcessExitError` if the process returns a non-zero error
code
- You can throw an error from this function; this allows you to scrape `stderr`
and do special error handling

The examples use this feature a couple of times.

See [stderr-support.ts](./runner/stderr-support.ts) for some functions that provide non-default `stderr` bahaviors. You can use these directly, and they also serve as good working examples.
See [stderr-support.ts](./runner/stderr-support.ts) for some functions that
provide non-default `stderr` bahaviors. You can use these directly, and they
also serve as good working examples.

### Overriding the Default Exit-Code Error Handling Behavior

For most of the output handlers, the second argument is optional and allows you to redefine the way that `proc` raises errors based on the process exit code.
For most of the output handlers, the second argument is optional and allows you
to redefine the way that `proc` raises errors based on the process exit code.

This doesn't come up very often, but occasionally you may not want to treat all non-zero exit codes as an error. You also may want to throw your own error rather than the standard `ProcessExitError`.

The default error handling definition is defined in [./runner/error-support.ts]. Refer to this code if you want to create a custom error handler.
This doesn't come up very often, but occasionally you may not want to treat all
non-zero exit codes as an error. You also may want to throw your own error
rather than the standard `ProcessExitError`.

The default error handling definition is defined in [./runner/error-support.ts].
Refer to this code if you want to create a custom error handler.
6 changes: 6 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes

## 0.13.6

- **documentation** Added _Direct Control Over `stderr`_ section.
- **documentation** Added _Overriding the Default Exit-Code Error Handling
Behavior_ section.

## 0.13.5

- `#16` **documentation** Minor documentation edits.
Expand Down

0 comments on commit 24a0414

Please sign in to comment.