We have registered the cancellationToken in the ProcessExtensions.WaitForExitAsync() . The registered cancellation handler attempts to write some data to the process's stdin.
If the process has already exited, there is a try/catch block exists which ignores the InvalidOperationException.
|
try |
|
{ |
|
if (stdInDataInput) |
|
// If standard input used for data input just close it. |
|
// It will force process to stop (closing files). |
|
process.StandardInput.Close(); |
|
else |
|
// Send "q" to ffmpeg, which will force it to stop (closing files). |
|
process.StandardInput.Write("q"); |
|
} |
|
catch (InvalidOperationException) |
|
{ |
|
// If the process doesn't exist anymore, ignore it. |
|
} |
However, theStreamWriter.Write() will throw an IOException here when attempting to write q to the stdin of a non-existent process. Therefore, it seems like that we also need to handle the IOException here.
We have registered the
cancellationTokenin theProcessExtensions.WaitForExitAsync(). The registered cancellation handler attempts to write some data to the process's stdin.If the process has already exited, there is a
try/catchblock exists which ignores theInvalidOperationException.FFmpeg.NET/src/FFmpeg.NET/Extensions/ProcessExtensions.cs
Lines 20 to 33 in 16fe394
However, the
StreamWriter.Write()will throw anIOExceptionhere when attempting to writeqto the stdin of a non-existent process. Therefore, it seems like that we also need to handle theIOExceptionhere.