You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add throwOnError to throw errors on non-zero exits (#34)
Introduces a new `throwOnError` option which will cause tinyexec to
throw any time a non-zero exit code is encountered.
If the exit code is `null`, we will not throw since it means something
went very wrong anyway (the process is still running and shouldn't be,
since we saw the `close` event by then).
If the exit code is greater than `0`, we will throw a
`NonZeroExitError` which has an `exitCode` property.
For example:
```ts
try {
await x('foo', [], {throwOnError: true});
} catch (err) {
if (err instanceof NonZeroExitCode) {
err.exitCode; // the exit code
err.result; // the tinyexec process
err.result.killed; // getters on tinyexec process
}
}
```
0 commit comments