I'm starting a process with Process.Start:
var psi = new ProcessStartInfo("yt-dlp.exe"){
ErrorDialog = false,
CreateNoWindow = true,
RedirectStandardError = true,
RedirectStandardOutput = true,
ArgumentList = {
"--prefer-insecure",
"--no-check-certificates",
"--dump-json",
"https://www.youtube.com/watch?v=dQw4w9WgXcQ"
},
};
var process = Process.Start(psi);
process.EnableRaisingEvents = true;
process.Exited += HandleProcessExit;
HandleProcessExit
is never called - the process never actually exits, judging by the fact that the process does not disappear from the Task Manager. Calling the process itself outside of C# (yt-dlp.exe --prefer-insecure --no-check-certificates --dump-json https://www.youtube.com/watch?v=dQw4w9WgXcQ
) in my command terminal works fine - the process exits.
Changing RedirectStandardError
and RedirectStandardOutput
to false
seems to fix the issue... however, I need to access these streams.
For context, the executable I'm using is yt-dlp, but I don't think that is the issue. How can I fix this?