keep the tone test output open across a reconnect

The saver reserves its output file exclusively, so opening it a second time
fails. connect opened a new one per connection and a disconnect closed it,
which meant the first reconnect died with "file exists" instead of resuming.

Open the saver once and re-attach it on reconnect, and close it on exit
instead. Detaching and closing are now separate, since only shutdown wants
both.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Brandon McGinty
2026-08-24 12:32:21 -04:00
co-authored by Claude Opus 5
parent 77fad24560
commit 5cdb2684b5
3 changed files with 38 additions and 14 deletions
+8 -4
View File
@@ -445,15 +445,19 @@ func (b *Barnard) OnMicVolumeUp(ui *uiterm.Ui, key uiterm.Key) {
}
func (b *Barnard) OnQuitPress(ui *uiterm.Ui, key uiterm.Key) {
b.stopReconnects()
b.StopRecordingIfActive(true)
b.Client.Disconnect()
b.Ui.Close()
b.shutdown()
}
func (b *Barnard) CommandExit(ui *uiterm.Ui, cmd string) {
b.shutdown()
}
// shutdown releases everything that outlives a single connection, including
// the tone test saver's output file, which reconnects deliberately keep open.
func (b *Barnard) shutdown() {
b.stopReconnects()
b.StopRecordingIfActive(true)
b.cleanupToneTestAudio()
b.Client.Disconnect()
b.Ui.Close()
}