mirror of
https://github.com/uutils/coreutils
synced 2024-11-15 17:28:03 +00:00
Flush pending stdout writes.
This commit is contained in:
parent
f84d5462a3
commit
17e732f0fd
4 changed files with 9 additions and 0 deletions
|
@ -22,6 +22,10 @@ use libc::consts::os::posix88::STDIN_FILENO;
|
|||
use libc::funcs::posix88::unistd::isatty;
|
||||
use libc::types::os::arch::c95::c_int;
|
||||
|
||||
#[path = "../common/util.rs"]
|
||||
#[macro_use]
|
||||
mod util;
|
||||
|
||||
static NAME: &'static str = "cat";
|
||||
static VERSION: &'static str = "1.0.0";
|
||||
|
||||
|
@ -252,6 +256,7 @@ fn exec(files: Vec<String>, number: NumberingMode, show_nonprint: bool,
|
|||
} else {
|
||||
write_fast(files);
|
||||
}
|
||||
pipe_flush!();
|
||||
}
|
||||
|
||||
fn open(path: &str) -> Option<(Box<Read>, bool)> {
|
||||
|
|
|
@ -227,6 +227,7 @@ fn show(path: &PathBuf, no_newline: bool, use_zero: bool) {
|
|||
} else {
|
||||
println!("{}", path);
|
||||
}
|
||||
pipe_flush!();
|
||||
}
|
||||
|
||||
fn show_usage(opts: &getopts::Options) {
|
||||
|
|
|
@ -59,6 +59,7 @@ fn delete<'a>(set: ExpandSet<'a>, complement: bool) {
|
|||
}
|
||||
if buf.len() > 0 {
|
||||
safe_unwrap!(stdout.write_all(&buf[..].as_bytes()));
|
||||
pipe_flush!();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,6 +95,7 @@ fn tr<'a>(set1: ExpandSet<'a>, mut set2: ExpandSet<'a>) {
|
|||
}
|
||||
if buf.len() > 0 {
|
||||
safe_unwrap!(stdout.write_all(&buf[..].as_bytes()));
|
||||
pipe_flush!();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -279,4 +279,5 @@ fn unexpand(options: Options) {
|
|||
buf.truncate(0); // clear out the buffer
|
||||
}
|
||||
}
|
||||
pipe_flush!(output);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue