Skip to content

Unhandled IOException when trying to cancel operation and the ffmpeg process has already exited #83

Description

@snechaev

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions