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 21:49:35 +01:00
committed by GitHub
co-authored by Kevin Burke
parent b54f0b1ff2
commit 4873c8a24b
+1 -1
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(());
}