From 8a837dae219f6f773dfd28753dcdccedc2828c36 Mon Sep 17 00:00:00 2001 From: ctsk <9384305+ctsk@users.noreply.github.com> Date: Mon, 5 Dec 2022 17:51:58 +0100 Subject: [PATCH] Tick after creating progress bar to draw it --- src/uu/cp/src/cp.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 2e4a4c2b4..f4054995f 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -971,16 +971,16 @@ fn copy(sources: &[Source], target: &TargetSlice, options: &Options) -> CopyResu let mut symlinked_files = HashSet::new(); let progress_bar = if options.progress_bar { - Some( - ProgressBar::new(disk_usage(sources, options.recursive)?) - .with_style( - ProgressStyle::with_template( - "{msg}: [{elapsed_precise}] {wide_bar} {bytes:>7}/{total_bytes:7}", - ) - .unwrap(), + let pb = ProgressBar::new(disk_usage(sources, options.recursive)?) + .with_style( + ProgressStyle::with_template( + "{msg}: [{elapsed_precise}] {wide_bar} {bytes:>7}/{total_bytes:7}", ) - .with_message(uucore::util_name()), - ) + .unwrap(), + ) + .with_message(uucore::util_name()); + pb.tick(); + Some(pb) } else { None };