Support #[unix_sigpipe = "inherit|sig_dfl|sig_ign"]
on fn main()
This makes it possible to instruct libstd to never touch the signal handler for `SIGPIPE`, which makes programs pipeable by default (e.g. with `./your-program | head -n 1`) without `ErrorKind::BrokenPipe` errors.
This commit is contained in:
parent
ee285eab69
commit
ddee45e1d7
46 changed files with 449 additions and 43 deletions
|
@ -0,0 +1,13 @@
|
|||
// run-pass
|
||||
// aux-build:sigpipe-utils.rs
|
||||
|
||||
#![feature(unix_sigpipe)]
|
||||
|
||||
fn main() {
|
||||
extern crate sigpipe_utils;
|
||||
|
||||
// Only #![feature(unix_sigpipe)] is enabled, not #[unix_sigpipe = "..."].
|
||||
// This shall not change any behavior, so we still expect SIGPIPE to be
|
||||
// ignored
|
||||
sigpipe_utils::assert_sigpipe_handler(sigpipe_utils::SignalHandler::Ignore);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue