diff options
| author | Claus Vium <clausvium@gmail.com> | 2019-02-24 22:04:30 +0100 |
|---|---|---|
| committer | Claus Vium <clausvium@gmail.com> | 2019-02-24 22:04:30 +0100 |
| commit | 547d0ecf584556019aa743687009a0f0d3a8f9dd (patch) | |
| tree | d90fa22729545d3007e7a663fcddf983b901ea4b | |
| parent | 96b3d37caf269789015900bd7f6fa24f17652848 (diff) | |
Move the check further down
| -rw-r--r-- | MediaBrowser.Controller/MediaEncoding/JobLogger.cs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs index 5cd6fd27a..46593fb2f 100644 --- a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs +++ b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs @@ -24,8 +24,7 @@ namespace MediaBrowser.Controller.MediaEncoding { using (var reader = new StreamReader(source)) { - // If ffmpeg process is closed, the state is disposed, so don't write to target in that case - while (!reader.EndOfStream && target.CanWrite) + while (!reader.EndOfStream) { var line = await reader.ReadLineAsync().ConfigureAwait(false); @@ -33,6 +32,12 @@ 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); } |
