fix(capture): use the named output errors and empty the list on Stop
- commit
- b0baaac67744386300608c61d1cf7d69b9ae5298
- author
- brice · · 2026-10-08 19:49 UTC
- parent
- 0640328
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +4 -3
M internal/adapters/outputkit/capture/offscreen.go +1 -1
| @@ -354,7 +354,7 @@ func (p *Pipeline) SubmitHidden(s ports.Scene, surfaces map[ports.WindowID]ports | |||
| 354 | 354 | fail(ErrSecurityState, reqs) | |
| 355 | 355 | return | |
| 356 | 356 | case s.Off: | |
| 357 | - | fail(errors.New("output off"), reqs) | |
| 357 | + | fail(ErrOutputOff, reqs) | |
| 358 | 358 | return | |
| 359 | 359 | case s.CaptureScene == nil || s.Capture == nil || s.Capture.Workspace == 0 && s.Capture.Window == 0: | |
| 360 | 360 | fail(ErrOffscreenUnavailable, reqs) | |
| @@ -354,7 +354,7 @@ func (p *Pipeline) SubmitHidden(s ports.Scene, surfaces map[ports.WindowID]ports | |||||
| 354 | fail(ErrSecurityState, reqs) | 354 | fail(ErrSecurityState, reqs) | ||
| 355 | return | 355 | return | ||
| 356 | case s.Off: | 356 | case s.Off: | ||
| 357 | - | fail(errors.New("output off"), reqs) | 357 | + | fail(ErrOutputOff, reqs) |
| 358 | return | 358 | return | ||
| 359 | case s.CaptureScene == nil || s.Capture == nil || s.Capture.Workspace == 0 && s.Capture.Window == 0: | 359 | case s.CaptureScene == nil || s.Capture == nil || s.Capture.Workspace == 0 && s.Capture.Window == 0: | ||
| 360 | fail(ErrOffscreenUnavailable, reqs) | 360 | fail(ErrOffscreenUnavailable, reqs) | ||
M internal/adapters/outputkit/capture/requests.go +1 -0
| @@ -81,6 +81,7 @@ func (r *Requests) Stop(incoming <-chan ports.CaptureRequest) { | |||
| 81 | 81 | Fail(r.ctx, q, ErrOutputStopped, r.replies) | |
| 82 | 82 | } | |
| 83 | 83 | } | |
| 84 | + | r.Reset() | |
| 84 | 85 | for { | |
| 85 | 86 | select { | |
| 86 | 87 | case q, ok := <-incoming: | |
| @@ -81,6 +81,7 @@ func (r *Requests) Stop(incoming <-chan ports.CaptureRequest) { | |||||
| 81 | Fail(r.ctx, q, ErrOutputStopped, r.replies) | 81 | Fail(r.ctx, q, ErrOutputStopped, r.replies) | ||
| 82 | } | 82 | } | ||
| 83 | } | 83 | } | ||
| 84 | + | r.Reset() | |||
| 84 | for { | 85 | for { | ||
| 85 | select { | 86 | select { | ||
| 86 | case q, ok := <-incoming: | 87 | case q, ok := <-incoming: | ||
M internal/app/outputs.go +2 -2
| @@ -469,7 +469,7 @@ func (s *outputSet) failQueued(r *runningOutput) { | |||
| 469 | 469 | for { | |
| 470 | 470 | select { | |
| 471 | 471 | case req := <-r.captures: | |
| 472 | - | capture.Fail(s.ctx, req, fmt.Errorf("output stopped"), s.captured) | |
| 472 | + | capture.Fail(s.ctx, req, capture.ErrOutputStopped, s.captured) | |
| 473 | 473 | default: | |
| 474 | 474 | return | |
| 475 | 475 | } | |
| @@ -485,7 +485,7 @@ func drainCaptures(ctx context.Context, incoming <-chan ports.CaptureRequest, re | |||
| 485 | 485 | if !ok { | |
| 486 | 486 | return | |
| 487 | 487 | } | |
| 488 | - | capture.Fail(ctx, q, fmt.Errorf("output stopped"), replies) | |
| 488 | + | capture.Fail(ctx, q, capture.ErrOutputStopped, replies) | |
| 489 | 489 | default: | |
| 490 | 490 | return | |
| 491 | 491 | } | |
| @@ -469,7 +469,7 @@ func (s *outputSet) failQueued(r *runningOutput) { | |||||
| 469 | for { | 469 | for { | ||
| 470 | select { | 470 | select { | ||
| 471 | case req := <-r.captures: | 471 | case req := <-r.captures: | ||
| 472 | - | capture.Fail(s.ctx, req, fmt.Errorf("output stopped"), s.captured) | 472 | + | capture.Fail(s.ctx, req, capture.ErrOutputStopped, s.captured) |
| 473 | default: | 473 | default: | ||
| 474 | return | 474 | return | ||
| 475 | } | 475 | } | ||
| @@ -485,7 +485,7 @@ func drainCaptures(ctx context.Context, incoming <-chan ports.CaptureRequest, re | |||||
| 485 | if !ok { | 485 | if !ok { | ||
| 486 | return | 486 | return | ||
| 487 | } | 487 | } | ||
| 488 | - | capture.Fail(ctx, q, fmt.Errorf("output stopped"), replies) | 488 | + | capture.Fail(ctx, q, capture.ErrOutputStopped, replies) |
| 489 | default: | 489 | default: | ||
| 490 | return | 490 | return | ||
| 491 | } | 491 | } | ||