1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

mv: ensure line prints (#1890)

Previously this used `print` instead of `println`, and as a result the
prompt would never appear and the command would hang. The Rust docs
note this about print:

> Note that stdout is frequently line-buffered by default so it may be
> necessary to use io::stdout().flush() to ensure the output is emitted
> immediately.

Changing to `println` fixes the issue.

Fixes #1889.

Co-authored-by: Kevin Burke <kevin@burke.dev>
This commit is contained in:
Kevin Burke 2021-03-23 13:49:35 -07:00 committed by GitHub
parent b54f0b1ff2
commit 4873c8a24b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -380,7 +380,7 @@ fn rename(from: &PathBuf, to: &PathBuf, b: &Behavior) -> io::Result<()> {
match b.overwrite {
OverwriteMode::NoClobber => return Ok(()),
OverwriteMode::Interactive => {
print!("{}: overwrite {}? ", executable!(), to.display());
println!("{}: overwrite {}? ", executable!(), to.display());
if !read_yes() {
return Ok(());
}