Skip to content

Commit

Permalink
Merge pull request #4179 from djedi23/verbose_and_progress
Browse files Browse the repository at this point in the history
Suspend the progress bar before printing the copied files.
  • Loading branch information
tertsdiepraam authored Nov 30, 2022
2 parents 558314e + 8b30ead commit efa0fd4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/uu/cp/src/cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,14 @@ fn copy_file(
}

if options.verbose {
println!("{}", context_for(source, dest));
if let Some(pb) = progress_bar {
// Suspend (hide) the progress bar so the println won't overlap with the progress bar.
pb.suspend(|| {
println!("{}", context_for(source, dest));
});
} else {
println!("{}", context_for(source, dest));
}
}

// Calculate the context upfront before canonicalizing the path
Expand Down

0 comments on commit efa0fd4

Please sign in to comment.