File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -401,14 +401,15 @@ fn head_file(input: &mut File, options: &HeadOptions) -> io::Result<u64> {
401401
402402#[ allow( clippy:: cognitive_complexity) ]
403403fn uu_head ( options : & HeadOptions ) -> UResult < ( ) > {
404+ let mut stdout = io:: stdout ( ) . lock ( ) ;
404405 let mut first = true ;
405406 for file in & options. files {
406407 let res = if file == "-" {
407408 if ( options. files . len ( ) > 1 && !options. quiet ) || options. verbose {
408409 if !first {
409- println ! ( ) ;
410+ writeln ! ( stdout ) ? ;
410411 }
411- println ! ( "{}" , translate!( "head-header-stdin" ) ) ;
412+ writeln ! ( stdout , "{}" , translate!( "head-header-stdin" ) ) ? ;
412413 }
413414 let stdin = io:: stdin ( ) ;
414415
@@ -463,11 +464,11 @@ fn uu_head(options: &HeadOptions) -> UResult<()> {
463464 } ;
464465 if ( options. files . len ( ) > 1 && !options. quiet ) || options. verbose {
465466 if !first {
466- println ! ( ) ;
467+ writeln ! ( stdout ) ? ;
467468 }
468- print ! ( "==> " ) ;
469+ write ! ( stdout , "==> " ) ? ;
469470 print_verbatim ( file) . unwrap ( ) ;
470- println ! ( " <==" ) ;
471+ writeln ! ( stdout , " <==" ) ? ;
471472 }
472473 head_file ( & mut file_handle, options) ?;
473474 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments