Skip to content

Commit cd50a4d

Browse files
oech3sylvestre
authored andcommitted
mkdir -pv a >/dev/full panics
1 parent 3164758 commit cd50a4d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/uu/mkdir/src/mkdir.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use clap::builder::ValueParser;
99
use clap::parser::ValuesRef;
1010
use clap::{Arg, ArgAction, ArgMatches, Command};
1111
use std::ffi::OsString;
12+
use std::io::{Write, stdout};
1213
use std::path::{Path, PathBuf};
1314
#[cfg(all(unix, target_os = "linux"))]
1415
use uucore::error::FromIo;
@@ -308,10 +309,11 @@ fn create_single_dir(path: &Path, is_parent: bool, config: &Config) -> UResult<(
308309
match create_dir_with_mode(path, create_mode) {
309310
Ok(()) => {
310311
if config.verbose {
311-
println!(
312+
writeln!(
313+
stdout(),
312314
"{}",
313315
translate!("mkdir-verbose-created-directory", "util_name" => uucore::util_name(), "path" => path.quote())
314-
);
316+
)?;
315317
}
316318

317319
// On Linux, we may need to add ACL permission bits via chmod.
@@ -357,10 +359,11 @@ fn create_single_dir(path: &Path, is_parent: bool, config: &Config) -> UResult<(
357359
// Print verbose message for logical directories, even if they exist
358360
// This matches GNU behavior for paths like "test_dir/../test_dir_a"
359361
if config.verbose && is_parent && config.recursive && !ends_with_parent_dir {
360-
println!(
362+
writeln!(
363+
stdout(),
361364
"{}",
362365
translate!("mkdir-verbose-created-directory", "util_name" => uucore::util_name(), "path" => path.quote())
363-
);
366+
)?;
364367
}
365368
Ok(())
366369
}

0 commit comments

Comments
 (0)