From 07d57ac109955c82446e993f1320792944614cb8 Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Fri, 22 May 2015 21:49:33 -0400 Subject: [PATCH] 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. --- src/echo/echo.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/echo/echo.rs b/src/echo/echo.rs index 3e8abdef2..1fe6b1608 100644 --- a/src/echo/echo.rs +++ b/src/echo/echo.rs @@ -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) -> i32 { } } - if !options.newline { + if options.newline { + let _ = stdout().flush(); + } else { println!("") }