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>
pull/3582/head
Tomas Dvorak 2 weeks ago
parent 456a513034
commit ee55d2006b

@ -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()

Loading…
Cancel
Save