use the enable_pipe_errors instead of libc::signal

This commit is contained in:
Sylvestre Ledru
2026-01-08 00:35:32 +01:00
parent 23b11eaf67
commit c78ccfa2a0
7 changed files with 7 additions and 19 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ path = "src/cat.rs"
clap = { workspace = true }
memchr = { workspace = true }
thiserror = { workspace = true }
uucore = { workspace = true, features = ["fast-inc", "fs", "pipes"] }
uucore = { workspace = true, features = ["fast-inc", "fs", "pipes", "signals"] }
fluent = { workspace = true }
[target.'cfg(unix)'.dependencies]
+1 -5
View File
@@ -20,8 +20,6 @@ use std::os::unix::fs::FileTypeExt;
use thiserror::Error;
use uucore::display::Quotable;
use uucore::error::UResult;
#[cfg(not(target_os = "windows"))]
use uucore::libc;
use uucore::translate;
use uucore::{fast_inc::fast_inc_one, format_usage};
@@ -225,9 +223,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
// (see https://github.com/rust-lang/rust/issues/62569), so we restore it's
// default action here.
#[cfg(not(target_os = "windows"))]
unsafe {
libc::signal(libc::SIGPIPE, libc::SIG_DFL);
}
let _ = uucore::signals::enable_pipe_errors();
let matches = uucore::clap_localization::handle_clap_result(uu_app(), args)?;
+1 -3
View File
@@ -1098,9 +1098,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
// Rust ignores SIGPIPE (see https://github.com/rust-lang/rust/issues/62569).
// We restore its default action here.
#[cfg(unix)]
unsafe {
libc::signal(libc::SIGPIPE, libc::SIG_DFL);
}
let _ = uucore::signals::enable_pipe_errors();
EnvAppData::default().run_env(args)
}
+1 -1
View File
@@ -23,7 +23,7 @@ clap = { workspace = true }
libc = { workspace = true }
memchr = { workspace = true }
notify = { workspace = true }
uucore = { workspace = true, features = ["fs", "parser-size"] }
uucore = { workspace = true, features = ["fs", "parser-size", "signals"] }
same-file = { workspace = true }
fluent = { workspace = true }
+1 -3
View File
@@ -45,9 +45,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
// (see https://github.com/rust-lang/rust/issues/62569), so we restore it's
// default action here.
#[cfg(not(target_os = "windows"))]
unsafe {
libc::signal(libc::SIGPIPE, libc::SIG_DFL);
}
let _ = uucore::signals::enable_pipe_errors();
let settings = parse_args(args)?;
+1 -1
View File
@@ -20,7 +20,7 @@ path = "src/tr.rs"
[dependencies]
nom = { workspace = true }
clap = { workspace = true }
uucore = { workspace = true, features = ["fs"] }
uucore = { workspace = true, features = ["fs", "signals"] }
fluent = { workspace = true }
bytecount = { workspace = true, features = ["runtime-dispatch-simd"] }
+1 -5
View File
@@ -18,8 +18,6 @@ use std::io::{stdin, stdout};
use uucore::display::Quotable;
use uucore::error::{UResult, USimpleError, UUsageError};
use uucore::fs::is_stdin_directory;
#[cfg(not(target_os = "windows"))]
use uucore::libc;
use uucore::translate;
use uucore::{format_usage, os_str_as_bytes, show};
@@ -38,9 +36,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
// (see https://github.com/rust-lang/rust/issues/62569), so we restore it's
// default action here.
#[cfg(not(target_os = "windows"))]
unsafe {
libc::signal(libc::SIGPIPE, libc::SIG_DFL);
}
let _ = uucore::signals::enable_pipe_errors();
let matches = uucore::clap_localization::handle_clap_result(uu_app(), args)?;