mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
Merge pull request #5765 from sylvestre/handle-full
handle the error when stdout is full
This commit is contained in:
commit
9f257adf59
1 changed files with 9 additions and 3 deletions
|
@ -105,9 +105,15 @@ macro_rules! bin {
|
||||||
($util:ident) => {
|
($util:ident) => {
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
uucore::panic::mute_sigpipe_panic(); // suppress extraneous error output for SIGPIPE failures/panics
|
// suppress extraneous error output for SIGPIPE failures/panics
|
||||||
let code = $util::uumain(uucore::args_os()); // execute utility code
|
uucore::panic::mute_sigpipe_panic();
|
||||||
std::io::stdout().flush().expect("could not flush stdout"); // (defensively) flush stdout for utility prior to exit; see <https://github.com/rust-lang/rust/issues/23818>
|
// execute utility code
|
||||||
|
let code = $util::uumain(uucore::args_os());
|
||||||
|
// (defensively) flush stdout for utility prior to exit; see <https://github.com/rust-lang/rust/issues/23818>
|
||||||
|
if let Err(e) = std::io::stdout().flush() {
|
||||||
|
eprintln!("Error flushing stdout: {}", e);
|
||||||
|
}
|
||||||
|
|
||||||
std::process::exit(code);
|
std::process::exit(code);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue