Repository: pop-os/popsicle (language: rust)

Issue:
Popsicle CLI reports incorrect percentage on complete
After completing the flashing process without errors, 100% should be output. I instead see 92.86% when flashing a small file using the usb script in the system76/firmware repository


Discussion / hints:
Here is an example of the output:

```
$ sudo popsicle usb.img /dev/disk/by-id/usb-Generic_Flash_Disk_9B262287-0:0 -cuy
V /dev/disk/by-id/usb-Generic_Flash_Disk_9B262287-0:0: 45.50 MB / 49.00 MB [=========================>-] 92.86 % 3.95 MB/s 1s 
```

Fix patch:
diff --git a/cli/src/main.rs b/cli/src/main.rs
index 1ab972b..7cc35be 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -153,9 +153,8 @@ fn popsicle() -> Result<(), String> {
                         pbs[id].set(bytes_written);
                     },
                     BusWriterMessage::Completed { id } => {
-                        if check {
-                            pbs[id].set(image_size);
-                        } else {
+                        pbs[id].set(image_size);
+                        if ! check {
                             pbs[id].finish();
                         }
                     }
@@ -201,6 +200,7 @@ fn popsicle() -> Result<(), String> {
                             errored_[unerrored_ids[id]].store(true, Ordering::SeqCst);
                         }
                         BusVerifierMessage::Valid { id } => {
+                            pbs[unerrored_ids[id]].set(image_size);
                             pbs[unerrored_ids[id]].finish();
                         }
                         BusVerifierMessage::Errored { id, why } => {


Test patch: