Skip to content

feat: stream par2 verify/repair progress to terminal#19

Merged
Xitee1 merged 2 commits into
mainfrom
feat/par2-progress-passthrough
May 12, 2026
Merged

feat: stream par2 verify/repair progress to terminal#19
Xitee1 merged 2 commits into
mainfrom
feat/par2-progress-passthrough

Conversation

@Xitee1
Copy link
Copy Markdown
Owner

@Xitee1 Xitee1 commented May 11, 2026

Summary

  • Add a passthrough=True mode to shell/runner.run() that lets the child inherit stdout/stderr directly — needed for tools that paint progress via \r (par2 verify/repair: "Scanning: X%" rewrites a single line, which the default streamer would buffer until the next \n).
  • Switch tools.par2.verify and tools.par2.repair to passthrough. Result detection moves off stdout-string matching ("All files are correct" / "Repair is required") onto par2cmdline's exit codes — 0/1/2 maps cleanly to VerifyResult OK/REPAIRABLE/BROKEN. Manually verified on par2cmdline 0.8.x.
  • Without this, the par2 phase of bd-archive verify (and the post-burn check inside burn) was a ~20 min black screen on a 25 GB BD-R. With it, the live percentage shows on the user's terminal exactly as par2 verify would print it standalone.

Pairs naturally with #18 (which dropped the sha512 pass) but is independent — touches only shell/runner.py, tools/par2.py, plus an AGENTS.md note. SIGINT handling is unchanged: child shares our process group, _check_sigint still converts -SIGINT returns into KeyboardInterrupt.

Test plan

  • ruff check passes on changed files
  • Manual: corrupted-not / lightly-corrupted / heavily-corrupted 50 MiB par2 set returns OK / REPAIRABLE / BROKEN respectively, and the live "Scanning: X%" progress shows during the run
  • Run bd-archive verify on a real BD-R and confirm the par2 percentage paints in place on the terminal
  • Run bd-archive extract on a disc with a damaged slice and confirm par2 repair output streams live

🤖 Generated with Claude Code

Xitee1 and others added 2 commits May 11, 2026 22:53
par2cmdline paints its "Scanning: X%" progress with \r updates on a
single line. The default `run()` streamer reads stdout line-by-line
(blocking until \n), so those updates piled up invisibly — `verify`
and `repair` showed no output for the ~20 min a 25 GB BD-R takes.

Add a `passthrough=True` mode to `shell/runner.run()` that lets the
child inherit our stdout/stderr directly, and switch par2.verify /
par2.repair to use it. Result detection moves from stdout-string
matching to par2cmdline's exit codes — 0/1/2 maps cleanly to
VerifyResult OK/REPAIRABLE/BROKEN (manually verified against
par2cmdline 0.8.x).

SIGINT handling is unchanged: the child still shares our process
group, and `_check_sigint` converts a -SIGINT return into
KeyboardInterrupt the same way as the other modes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Xitee1 Xitee1 merged commit ee26724 into main May 12, 2026
1 check passed
@Xitee1 Xitee1 deleted the feat/par2-progress-passthrough branch May 12, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant