A scoped signal deflector.
(Unrelated to the 2005 fantasy film of similar name.)
Current operating system support: Unix (via the nix
crate).
The crate otherwise compiles without function,
unless the "required"
feature (active by default) is active.
Please use cargo-edit to always add the latest version of this library:
cargo add mirror-mask
If your program does not rely on mirror-mask
for correctness,
you can allow it to compile without function for unsupported targets.
cargo add mirror-mask --no-default-features
let mut child = std::process::Command
::new("ping")
.args(["example.com", "-c", "3"])
.spawn().unwrap();
{
let _relay_guard = mirror_mask::Intent::InterruptFromKeyboard.relay_to_child(&child); // <--
child.wait().ok(); // Press Ctrl-c about here.
}
println!("Still alive!");
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
See CONTRIBUTING for more information.
Run
cargo run --all-features
or
cargo run --all-features -- -r
and press (with -r
/--recursive
repeatedly Enter and then) Ctrl+c.
The program should exit gracefully.
mirror-mask
strictly follows Semantic Versioning 2.0.0 with the following exceptions:
- The minor version will not reset to 0 on major version changes (except for v1).
Consider it the global feature level. - The patch version will not reset to 0 on major or minor version changes (except for v0.1 and v1).
Consider it the global patch level.
This includes the Rust version requirement specified above.
Earlier Rust versions may be compatible, but this can change with minor or patch releases.
Which versions are affected by features and patches can be determined from the respective headings in CHANGELOG.md.
Note that dependencies of this crate may have a more lenient MSRV policy!
Please use cargo +nightly update -Z minimal-versions
in your automation if you don't generate Cargo.lock manually (or as necessary) and require support for a compiler older than current stable.