From 735f3ae6adf8eae6bf0f81957ce292c1ec987c38 Mon Sep 17 00:00:00 2001 From: Daniel Rainer Date: Sun, 1 Mar 2026 21:21:26 +0100 Subject: [PATCH] cleanup: remove obsolete `wperror` Part of #12502 --- src/proc.rs | 5 ++--- src/wutil/mod.rs | 9 +-------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/proc.rs b/src/proc.rs index 29c04b3b5..c6db81781 100644 --- a/src/proc.rs +++ b/src/proc.rs @@ -19,7 +19,7 @@ use crate::signal::{Signal, signal_set_handlers_once}; use crate::topic_monitor::{GenerationsList, Topic, topic_monitor_principal}; use crate::wait_handle::{InternalJobId, WaitHandle, WaitHandleRef, WaitHandleStore}; -use crate::wutil::{wbasename, wperror}; +use crate::wutil::{perror, wbasename}; use cfg_if::cfg_if; use fish_widestring::ToWString; use libc::{ @@ -854,8 +854,7 @@ pub fn resume(&self) -> bool { pub fn signal(&self, signal: NixSignal) -> bool { if let Some(pgid) = self.group().get_pgid() { if killpg(pgid.as_nix_pid(), signal).is_err() { - let strsignal = signal.as_str(); - wperror(&sprintf!("killpg(%d, %s)", pgid, strsignal)); + perror(&format!("killpg({pgid}, {})", signal.as_str())); return false; } } else { diff --git a/src/wutil/mod.rs b/src/wutil/mod.rs index 1ba7064c0..96df17dc5 100644 --- a/src/wutil/mod.rs +++ b/src/wutil/mod.rs @@ -14,7 +14,7 @@ use crate::topic_monitor::Topic; use errno::errno; use fish_util::write_to_fd; -use fish_wcstringutil::{join_strings, str2bytes_callback, wcs2bytes, wcs2osstring, wcs2zstring}; +use fish_wcstringutil::{join_strings, str2bytes_callback, wcs2osstring, wcs2zstring}; use fish_widestring::{IntoCharIter, L, WExt as _, WString, wstr}; use nix::unistd::AccessFlags; use std::ffi::{CStr, OsStr}; @@ -66,13 +66,6 @@ pub fn wunlink(file_name: &wstr) -> io::Result<()> { fs::remove_file(tmp) } -pub fn wperror(s: &wstr) { - let bytes = wcs2bytes(s); - // We can't guarantee the string is 100% Unicode (why?), so we don't use std::str::from_utf8() - let s = OsStr::from_bytes(&bytes).to_string_lossy(); - perror(&s); -} - /// Port of the wide-string wperror from `src/wutil.cpp` but for rust `&str`. pub fn perror(s: &str) { let e = errno().0;