diff --git a/src/uu/expand/src/expand.rs b/src/uu/expand/src/expand.rs index 74a549687..49e189115 100644 --- a/src/uu/expand/src/expand.rs +++ b/src/uu/expand/src/expand.rs @@ -244,10 +244,10 @@ fn expand(options: Options) { } } - safe_unwrap!(output.flush()); byte += nbytes; // advance the pointer } + safe_unwrap!(output.flush()); buf.truncate(0); // clear the buffer } } diff --git a/src/uu/unexpand/src/unexpand.rs b/src/uu/unexpand/src/unexpand.rs index 3c680f8c4..f224441e1 100644 --- a/src/uu/unexpand/src/unexpand.rs +++ b/src/uu/unexpand/src/unexpand.rs @@ -324,6 +324,7 @@ fn unexpand(options: Options) { // write out anything remaining write_tabs(&mut output, ts, scol, col, pctype == Tab, init, true); + safe_unwrap!(output.flush()); buf.truncate(0); // clear out the buffer } }