From ee55d2006b175e51af0ae8a1ce9ab0f61c06845a Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Sat, 19 Sep 2026 10:08:21 +0200 Subject: [PATCH] fix(downloader): drain yt-dlp pipes before Wait to avoid output loss exec.Cmd.Wait closes the stdout/stderr pipes on process exit, which discards buffered output the scanners have not read yet - a race that dropped progress lines and stderr tails on CI. Readers now drain to EOF first, then Wait reaps the process and returns the exit code. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- pkg/downloader/ytdlp/ytdlp.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/downloader/ytdlp/ytdlp.go b/pkg/downloader/ytdlp/ytdlp.go index 77c148e1..37181931 100644 --- a/pkg/downloader/ytdlp/ytdlp.go +++ b/pkg/downloader/ytdlp/ytdlp.go @@ -208,8 +208,10 @@ func (p *ytdlpProcess) run(stdout, stderr io.Reader) { p.scanErrors(stderr) }() - err := p.cmd.Wait() + // Drain the readers to EOF before Wait: Wait closes the pipes on + // process exit and would discard any buffered output still unread. wg.Wait() + err := p.cmd.Wait() p.mu.Lock() defer p.mu.Unlock()