From 0a25eb192540f5336c5aa4babd612360c7a071f5 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Sun, 15 Feb 2026 14:59:26 +0900 Subject: [PATCH] dircolors >/dev/full panics --- src/uu/dircolors/src/dircolors.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 815c3422e42..f704b26019d 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -10,7 +10,7 @@ use std::env; use std::ffi::OsString; use std::fmt::Write as _; use std::fs::File; -use std::io::{BufRead, BufReader}; +use std::io::{BufRead, BufReader, Write, stdout}; use std::path::Path; use clap::{Arg, ArgAction, Command}; @@ -150,7 +150,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { )); } - println!("{}", generate_dircolors_config()); + writeln!(stdout(), "{}", generate_dircolors_config())?; return Ok(()); } @@ -178,13 +178,13 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { let result; if files.is_empty() { - println!("{}", generate_ls_colors(&out_format, ":")); + writeln!(stdout(), "{}", generate_ls_colors(&out_format, ":"))?; return Ok(()); /* // Check if data is being piped into the program if std::io::stdin().is_terminal() { // No data piped, use default behavior - println!("{}", generate_ls_colors(&out_format, ":")); + writeln!(stdout(), "{}", generate_ls_colors(&out_format, ":"))?; return Ok(()); } else { // Data is piped, process the input from stdin @@ -230,7 +230,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { match result { Ok(s) => { - println!("{s}"); + writeln!(stdout(), "{s}")?; Ok(()) } Err(s) => Err(USimpleError::new(1, s)),