fix: kill ttyd process on early exit from Evaluate#737
Open
tomenden wants to merge 1 commit intocharmbracelet:mainfrom
Open
fix: kill ttyd process on early exit from Evaluate#737tomenden wants to merge 1 commit intocharmbracelet:mainfrom
tomenden wants to merge 1 commit intocharmbracelet:mainfrom
Conversation
The deferred cleanup in Evaluate() only called v.close(), which closes the browser but not the ttyd process. Any early return between Start() and the teardown() call (e.g. SET command failure, dimension check, Hide block error) would leave an orphaned ttyd process running. Also clean up ttyd in Start() if browser launch or page creation fails.
Author
|
Fixes #738 |
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.
Fixes #738
Summary
ttydprocesses are left running after VHS exits whenEvaluate()returns early (beforeRecord()/teardown()are reached).The deferred cleanup at
evaluator.go:45only callsv.close(), which is set tovhs.browser.Close— it never kills thettydprocess. Theterminate()method that properly kills both browser and ttyd is only called viateardown(), which is only reachable afterRecord()starts.Affected code paths (all between
Start()andRecord()):Page.Waitfails (line 50-53)SETcommand fails (line 59-63)Hideblock command fails (line 106-109)Additionally,
Start()itself didn't clean up ttyd if browser launch or page creation failed after ttyd was already started.Fix
evaluator.go: The deferred cleanup now also kills the ttyd process, so every early-return path is covered.vhs.go:Start()now kills ttyd if subsequent browser/page setup fails, preventing orphaned processes even on initialization errors.Test plan
go build ./...passesvhswith a tape that triggers an early exit (e.g., invalid SET command), then verify no orphanedttydprocesses remain (ps aux | grep ttyd)vhsnormally and verify recordings still work correctly