From ac0171fc46ba827e92faa60a93e0c41916f02195 Mon Sep 17 00:00:00 2001 From: Devel Date: Wed, 5 Aug 2026 20:16:22 +0300 Subject: [PATCH] xargs: strip errno when arg-file doesn't exist --- src/xargs/mod.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/xargs/mod.rs b/src/xargs/mod.rs index ff833335..070f1bbc 100644 --- a/src/xargs/mod.rs +++ b/src/xargs/mod.rs @@ -1183,11 +1183,14 @@ fn do_xargs(args: &[&str]) -> Result { builder_options.verbose = options.verbose; builder_options.close_stdin = options.arg_file.is_none(); - let args_file: Box = if let Some(path) = &options.arg_file { - Box::new(fs::File::open(path).map_err(|e| format!("Failed to open {path}: {e}"))?) - } else { - Box::new(io::stdin()) - }; + let args_file: Box = + if let Some(path) = &options.arg_file { + Box::new(fs::File::open(path).map_err(|e| { + format!("Failed to open {path}: {}", uucore::error::strip_errno(&e)) + })?) + } else { + Box::new(io::stdin()) + }; let mut args: Box = if let Some(delimiter) = options.delimiter { Box::new(ByteDelimitedArgumentReader::new(args_file, delimiter))