FauconFan / FauconFan/mdbook-cmdrun

Fail on non-zero exit status

Open
#18 6 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
44
Forks
8
PR merge metrics
No merged PRs in 30d

Description

I'd like to add an extra check after the command has been run to ensure that it exited with a non-zero status.

(Context: it took me a long time to figure out I was just mis-spelling an option to the command I was running.)

The check would be put into

https://github.com/FauconFan/mdbook-cmdrun/blob/d1fef67f100563c2a433b1f5dd5a71810db6b90d/src/cmdrun.rs#L162-L168

and it could look something like

```rust
if output.status.success() {
return Err(NonZeroStatus(&command, &output));
}
```

And `NonZeroStatus` would just be an error type a la https://doc.rust-lang.org/rust-by-example/error/multiple_error_types/define_error_type.html
(Sidenote, this seems like a common thing maybe this is already implemented somewhere and I missed it?)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.