aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2019-02-27 00:27:25 -0500
committerGitHub <noreply@github.com>2019-02-27 00:27:25 -0500
commitba78f6a0ff133647c8a4559345bd3697cd0a90dd (patch)
tree07689d2ca66f446c0dab139dbcf02c65012d2808
parent968e282c907f57d7998b6435cadae2f0a5ec832c (diff)
parent547d0ecf584556019aa743687009a0f0d3a8f9dd (diff)
Merge pull request #999 from cvium/dont_write_disposed_log
Check that ffmpeg log target isn't disposed before writing to it
-rw-r--r--MediaBrowser.Controller/MediaEncoding/JobLogger.cs11
1 files changed, 6 insertions, 5 deletions
diff --git a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs
index b812a8ddc..46593fb2f 100644
--- a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs
+++ b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs
@@ -32,16 +32,17 @@ namespace MediaBrowser.Controller.MediaEncoding
var bytes = Encoding.UTF8.GetBytes(Environment.NewLine + line);
+ // If ffmpeg process is closed, the state is disposed, so don't write to target in that case
+ if (!target.CanWrite)
+ {
+ break;
+ }
+
await target.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
await target.FlushAsync().ConfigureAwait(false);
}
}
}
- catch (ObjectDisposedException)
- {
- //TODO Investigate and properly fix.
- // Don't spam the log. This doesn't seem to throw in windows, but sometimes under linux
- }
catch (Exception ex)
{
_logger.LogError(ex, "Error reading ffmpeg log");