The Wayback Machine - https://web.archive.org/web/20260107060539/https://github.com/docker/cli/pull/4157
Skip to content

Conversation

@cpuguy83
Copy link
Collaborator

@cpuguy83 cpuguy83 commented Apr 3, 2023

Cherry-picks #4137

cpuguy83 added 6 commits April 3, 2023 22:30
This fixes a case where a non-tty will have control characters + the log
line for every single read operation.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit f27927d)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
- Instead of rewriting the entire line every time only clear and write
the parts that changed.
- Hide the cursor while writing progress

Both these things make the progress updates significantly easier to
read.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit ccae6e9)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This just makes it easier to reason about what is happening.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit efd011b)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Only show progress updates after a time threshold has elapsed in order
to reduce the number of writes to the terminal.
This improves readability of the progress.

Also moves cursor show/hide into the progress printer to reduce chances
if messing up the user's terminal in case of cancellation.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 90b7bc3)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit b9a1b09)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This moves all the terminal writing to a goroutine that updates the
terminal periodically.
In our MITM copier we just use an atomic to add to the total number of
bytes read/written, the goroutine reads the total and updates the
terminal as needed.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit eb392ff)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83 cpuguy83 added kind/bugfix PR's that fix bugs area/ux labels Apr 3, 2023
@cpuguy83 cpuguy83 added this to the 23.0.3 milestone Apr 3, 2023
@thaJeztah thaJeztah changed the title 23.0 improve cp progress [23.0 backport] improve cp progress Apr 4, 2023
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah modified the milestones: 23.0.3, 23.0.4 Apr 4, 2023
@thaJeztah thaJeztah merged commit 683b099 into docker:23.0 Apr 5, 2023
@cpuguy83 cpuguy83 deleted the 23.0_improve_cp_progress branch April 17, 2023 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment