Repository navigation
feat(mkv-music): stop cleanly on Ctrl+C and pass a context to every child process and Plex request - #311
Merged
Conversation
…hild process and Plex request
…n progress, list stopped videos
…ame the stopped step and the skipped audio pass
…d-3 comment wording
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #294
Problem
Ctrl+C killed mkv-music wherever it was, including mid-tag-copy or mid-Plex-refresh. It also passed no
context.Contextto its children (mkvmerge,mkvextract,exiftool) or Plex requests, whichnoctxneeds. This ports the cbz-fix/mkv-audit design (#304, #306) to mkv-music.Change
mkv-music/interrupt.go,command*.goand their tests: copied from mkv-audit, with names, notices and test helper env vars adapted.mkv-music/processor.go:Runchecks ctx in the walk and before each video, and after every prompt, before the answer is used. A prompt the Ctrl+C lands on prints[STOP]and changes nothing.context.Canceledcounts as a stop. A stopped step prints[STOP]and is listed underTAGGING INTERRUPTEDas<path> (stopped: tags|timestamps); the Tags line adds, N stopped. A step that fails on its own during the kill is still a failure.tags.go,tags_mka.go: every read goes throughcommand(ctx, …);mkvpropeditruns oncontext.Background(), so it is never killed.CopyTagsToMKVchecks the kill after its reads and edits nothing if it fired, andTagsMatchMKVreports the kill instead of a match.audio_timestamps.go:exiftoolis killable, and the pass stops at the next file once interrupted.plex.go: requests usehttp.NewRequestWithContext; the token stays in the header.prompt.go: mkv-audit's prompter, returning the answer with only the line ending trimmed, so ignore patterns keep their spaces.main.go: the audio pass is skipped (with a notice) once interrupted; the exiftool warning now names the lookup error, soexec.ErrDotis visible. The summary is headedINTERRUPTED, drops the "nothing skipped" all-clear, and the exit code is 130.README.md: the Ctrl+C behaviour.Behavior
Before: Ctrl+C killed mkv-music and its children at once; a Plex refresh or tag copy in flight was cut off unreported.
After:
mkvmerge,mkvextractandexiftooland abandons the Plex request. A step it stops leaves the file as it was and is listed for a rerun with a covering--cutoff-date.Left for #294: sw-update, mkv-tvshow, mkv-movie, re-raising the signal instead of exiting 130, and enabling
noctx.Verification
nohup.golangci-lint run --enable-only noctxreports 0 issues for mkv-music, Windows and Linux.AI assistance
Written with Claude Code (Claude Opus 5.5). It self-reviewed the diff over four rounds and ran the checks above.