From f1c943ed31d9d44cc1316f05042ec9f0505edec7 Mon Sep 17 00:00:00 2001 From: Ideflop <94184575+Ideflop@users.noreply.github.com> Date: Tue, 30 May 2023 09:03:00 +0200 Subject: [PATCH] more: error handling for write_all in function paging_add_back_message --- src/uu/more/src/more.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index 9be9b5576..a43489566 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -344,7 +344,7 @@ fn more( .. }) => { pager.page_up(); - paging_add_back_message(options, stdout); + paging_add_back_message(options, stdout)?; } Event::Key(KeyEvent { code: KeyCode::Char('j'), @@ -556,11 +556,12 @@ impl<'a> Pager<'a> { } } -fn paging_add_back_message(options: &Options, stdout: &mut std::io::Stdout) { +fn paging_add_back_message(options: &Options, stdout: &mut std::io::Stdout) -> UResult<()> { if options.lines.is_some() { - execute!(stdout, MoveUp(1)).unwrap(); - stdout.write_all("\n\r...back 1 page\n".as_bytes()).unwrap(); + execute!(stdout, MoveUp(1))?; + stdout.write_all("\n\r...back 1 page\n".as_bytes())?; } + Ok(()) } // Break the lines on the cols of the terminal