Skip to main content

max / alloy

Keep dd's progress on a terminal, where its carriage returns mean something `status=progress` redraws a single line. With no cursor to move — a log, a pipe, an agent transcript — every update is kept instead, and a five-gigabyte write arrives as one line thousands of characters long with the only interesting part at the far end. A terminal still gets the live line. Everything else gets dd's default, which prints the transfer summary once at the end, which is all a log wanted from it.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-08-09 23:51 UTC
Signed with PGP, not checked
Commit: a9783abcf9dd919da7ca89f28f991124d1ecf7af
Parent: d778a60
1 file changed, +14 insertions, -1 deletion
@@ -64,7 +64,20 @@
64 64 [ "$reply" = "$DEVICE" ] || die "confirmation did not match; not writing"
65 65
66 66 echo "==> Writing $ARTIFACT to $DEVICE"
67 - sudo dd if="$ARTIFACT" of="$DEVICE" bs=4M oflag=direct conv=fsync status=progress
67 + # `status=progress` redraws one line with carriage returns, which is what a
68 + # person watching a five-gigabyte write wants and exactly wrong for anything
69 + # that keeps what it is given. A log, a pipe or an agent's transcript has no
70 + # cursor to move, so every update is retained and the write arrives as a single
71 + # line thousands of characters long with the useful part at the far end.
72 + #
73 + # So the progress goes to a terminal and nowhere else. Without one, dd's default
74 + # still prints the transfer summary once, at the end, which is the whole of what
75 + # a log wants from it. Checked on stderr because that is where dd writes both.
76 + if [ -t 2 ]; then
77 + sudo dd if="$ARTIFACT" of="$DEVICE" bs=4M oflag=direct conv=fsync status=progress
78 + else
79 + sudo dd if="$ARTIFACT" of="$DEVICE" bs=4M oflag=direct conv=fsync
80 + fi
68 81 sync
69 82
70 83 # Verify, because dd reporting success is not evidence the bytes landed.