From bc26481558298e2172dfeb033049a2dcc1f64691 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 29 Dec 2024 14:36:11 +0100 Subject: [PATCH] Retry writing some escape sequences on EINTR Maybe we should be using SA_RESTART? --- src/input_common.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/input_common.rs b/src/input_common.rs index 3602e385d..2c43ee508 100644 --- a/src/input_common.rs +++ b/src/input_common.rs @@ -2,7 +2,7 @@ use libc::STDOUT_FILENO; use crate::common::{ fish_reserved_codepoint, is_windows_subsystem_for_linux, read_blocked, shell_modes, - str2wcstring, WSL, + str2wcstring, write_loop, WSL, }; use crate::env::{EnvStack, Environment}; use crate::fd_readable_set::FdReadableSet; @@ -18,7 +18,7 @@ use crate::threads::{iothread_port, is_main_thread}; use crate::universal_notifier::default_notifier; use crate::wchar::{encode_byte_to_char, prelude::*}; use crate::wutil::encoding::{mbrtowc, mbstate_t, zero_mbstate}; -use crate::wutil::{fish_wcstol, write_to_fd}; +use crate::wutil::fish_wcstol; use std::collections::VecDeque; use std::ops::ControlFlow; use std::os::fd::RawFd; @@ -495,9 +495,9 @@ pub fn terminal_protocols_enable_ifn() { ) }; FLOG!(term_protocols, "Enabling extended keys and bracketed paste"); - let _ = write_to_fd(sequences.as_bytes(), STDOUT_FILENO); + let _ = write_loop(&STDOUT_FILENO, sequences.as_bytes()); if IS_TMUX.load() { - let _ = write_to_fd("\x1b[?1004h".as_bytes(), STDOUT_FILENO); + let _ = write_loop(&STDOUT_FILENO, "\x1b[?1004h".as_bytes()); } reader_current_data().map(|data| data.save_screen_state()); } @@ -522,9 +522,9 @@ pub(crate) fn terminal_protocols_disable_ifn() { term_protocols, "Disabling extended keys and bracketed paste" ); - let _ = write_to_fd(sequences.as_bytes(), STDOUT_FILENO); + let _ = write_loop(&STDOUT_FILENO, sequences.as_bytes()); if IS_TMUX.load() { - let _ = write_to_fd("\x1b[?1004l".as_bytes(), STDOUT_FILENO); + let _ = write_loop(&STDOUT_FILENO, "\x1b[?1004l".as_bytes()); } if is_main_thread() { reader_current_data().map(|data| data.save_screen_state());