Fix failure to print stdout for echo.

Upon program termination, pending stdout writes were not automatically
flushed. When newlines are disabled, I force a flush to stdout.
This commit is contained in:
Joseph Crail 2015-05-22 21:49:33 -04:00
parent 98a86e60c8
commit 07d57ac109

View file

@ -12,6 +12,7 @@
extern crate getopts;
extern crate libc;
use std::io::{stdout, Write};
use std::str::from_utf8;
#[path = "../common/util.rs"]
@ -242,7 +243,9 @@ pub fn uumain(args: Vec<String>) -> i32 {
}
}
if !options.newline {
if options.newline {
let _ = stdout().flush();
} else {
println!("")
}