From 41e82c8c9e09890761c4a320e9a6a7b2e9689496 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 29 Dec 2024 14:36:11 +0100 Subject: [PATCH] Protect some cursor movements against untimely ctrl-c Commit 01dbfb0a3f (replace writestr() with fwprintf() in reader.cpp, 2016-12-20) accidentally replaced a retry-on-EINTR write with a non-retrying version. Commit 7f31acbf9b (Prevent fish_title output from triggering a bel, 2022-02-02) fixed this for some cases but not all, fix that. --- src/reader.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/reader.rs b/src/reader.rs index 5a8653a2d..fcc608a2f 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -130,7 +130,7 @@ use crate::wcstringutil::{ string_prefixes_string_case_insensitive, StringFuzzyMatch, }; use crate::wildcard::wildcard_has; -use crate::wutil::{fstat, perror, write_to_fd}; +use crate::wutil::{fstat, perror}; use crate::{abbrs, event, function, history}; /// A description of where fish is in the process of exiting. @@ -1979,7 +1979,7 @@ impl<'a> Reader<'a> { // HACK: If stdin isn't the same terminal as stdout, we just moved the cursor. // For now, just reset it to the beginning of the line. if zelf.conf.inputfd != STDIN_FILENO { - let _ = write_to_fd(b"\r", STDOUT_FILENO); + let _ = write_loop(&STDOUT_FILENO, b"\r"); } // Ensure we have no pager contents when we exit. @@ -4142,7 +4142,7 @@ pub fn reader_write_title( .set_color(RgbColor::RESET, RgbColor::RESET); if reset_cursor_position && !lst.is_empty() { // Put the cursor back at the beginning of the line (issue #2453). - let _ = write_to_fd(b"\r", STDOUT_FILENO); + let _ = write_loop(&STDOUT_FILENO, b"\r"); } }