Skip to content

Commit d2f5cfd

Browse files
authored
echo --version >/dev/full panics (uutils#10853)
1 parent dec633c commit d2f5cfd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/uu/echo/src/echo.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use clap::builder::ValueParser;
77
use clap::{Arg, ArgAction, Command};
88
use std::env;
99
use std::ffi::{OsStr, OsString};
10-
use std::io::{self, StdoutLock, Write};
10+
use std::io::{StdoutLock, Write, stdout};
1111
use uucore::error::UResult;
1212
use uucore::format::{FormatChar, OctalParsing, parse_escape_only};
1313
use uucore::{format_usage, os_str_as_bytes};
@@ -166,7 +166,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
166166
uu_app().print_help()?;
167167
return Ok(());
168168
} else if first_arg == "--version" && args.peek().is_none() {
169-
print!("{}", uu_app().render_version());
169+
write!(stdout(), "{}", uu_app().render_version())?;
170170
return Ok(());
171171
}
172172

@@ -177,7 +177,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
177177
(Box::new(args), Options::default())
178178
};
179179

180-
execute(&mut io::stdout().lock(), args, options)?;
180+
execute(&mut stdout().lock(), args, options)?;
181181

182182
Ok(())
183183
}

0 commit comments

Comments
 (0)