https://github.com/rukai/simple_command
Simple command runner for build.rs
https://github.com/rukai/simple_command
Last synced: 3 months ago
JSON representation
Simple command runner for build.rs
- Host: GitHub
- URL: https://github.com/rukai/simple_command
- Owner: rukai
- License: mit
- Created: 2019-01-11T05:35:54.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-17T08:40:54.000Z (over 6 years ago)
- Last Synced: 2025-03-14T20:20:06.372Z (3 months ago)
- Language: Rust
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# Simple Command [](https://travis-ci.com/rukai/simple_command) [](https://crates.io/crates/simple_command)
When writing a `build.rs` to run some commands you naturally want to see the output of these commands.
This is however impossible because `build.rs` cannot display stdout or stderr.
The next best option is to display the output when the command goes wrong for any reason.
The `simple_command` function does exactly that, panicking if anything at all goes wrong and
displaying the combined stderr and stdout.Possible reasons for panicking include:
* No command specified
* Command does not exist
* Non-zero return valueDO NOT use this function in your actual application, you should be properly handling error cases!
## Example build.rs
```
use simple_command::simple_command;fn main() {
// this should succeed
simple_command::simple_command("ls");// this should panic, because `tree --foo` gives non-zero return code
simple_command::simple_command("tree --foo");
}
```## Documentation
Refer to [docs.rs](https://docs.rs/simple_command) for the full, very small, API.