summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-12-31 17:35:38 +0300
committerGrail Finder <wohilas@gmail.com>2025-12-31 17:35:38 +0300
commitd7c443c8930fdae24b1bbf98a9d6a2e7cf197cf2 (patch)
tree059d79f1b6f949ce1f42b5a40fc126abfecd52d8 /extra
parent5b8880ebc80e3ce4ab4bc5118d1ca657e84c8834 (diff)
Fix: recreate ctx after cancel for subseq recordings to workHEADmaster
Diffstat (limited to 'extra')
-rw-r--r--extra/whisper_binary.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/extra/whisper_binary.go b/extra/whisper_binary.go
index a016a30..31c083c 100644
--- a/extra/whisper_binary.go
+++ b/extra/whisper_binary.go
@@ -48,6 +48,11 @@ func (w *WhisperBinary) StartRecording() error {
if w.recording {
return errors.New("recording is already in progress")
}
+ // If context is cancelled, create a new one for the next recording session
+ if w.ctx.Err() != nil {
+ w.logger.Debug("Context cancelled, creating new context")
+ w.ctx, w.cancel = context.WithCancel(context.Background())
+ }
// Temporarily redirect stderr to suppress ALSA warnings during PortAudio init
origStderr, errDup := syscall.Dup(syscall.Stderr)
if errDup != nil {