Skip to content

Commit

Permalink
cp: fix verbose output order after prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
aimerlief committed Feb 8, 2025
1 parent d86a7fb commit f13d531
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/uu/cp/src/cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2271,10 +2271,6 @@ fn copy_file(
.into());
}

if options.verbose {
print_verbose_output(options.parents, progress_bar, source, dest);
}

if options.preserve_hard_links() {
// if we encounter a matching device/inode pair in the source tree
// we can arrange to create a hard link between the corresponding names
Expand All @@ -2284,6 +2280,11 @@ fn copy_file(
.context(format!("cannot stat {}", source.quote()))?,
) {
std::fs::hard_link(new_source, dest)?;

if options.verbose {
print_verbose_output(options.parents, progress_bar, source, dest);
}

return Ok(());
};
}
Expand Down Expand Up @@ -2334,6 +2335,10 @@ fn copy_file(
source_is_stream,
)?;

if options.verbose {
print_verbose_output(options.parents, progress_bar, source, dest);
}

// TODO: implement something similar to gnu's lchown
if !dest_is_symlink {
// Here, to match GNU semantics, we quietly ignore an error
Expand Down

0 comments on commit f13d531

Please # to comment.