diff --git a/src/SongProcessor/Utils/ProcessUtils.cs b/src/SongProcessor/Utils/ProcessUtils.cs index 5f2d1cf..8e40344 100644 --- a/src/SongProcessor/Utils/ProcessUtils.cs +++ b/src/SongProcessor/Utils/ProcessUtils.cs @@ -128,7 +128,7 @@ public static Task RunAsync(this Process process, OutputMode mode) var tcs = new TaskCompletionSource(); process.EnableRaisingEvents = true; - process.OnComplete(code => tcs.SetResult(code)); + process.OnComplete(tcs.SetResult); process.Start(); if ((mode & OutputMode.Async) != 0) diff --git a/tests/SongProcessor.Tests/FFmpeg/Jobs/VideoSongJob_Tests.cs b/tests/SongProcessor.Tests/FFmpeg/Jobs/VideoSongJob_Tests.cs index 5263815..5b85d04 100644 --- a/tests/SongProcessor.Tests/FFmpeg/Jobs/VideoSongJob_Tests.cs +++ b/tests/SongProcessor.Tests/FFmpeg/Jobs/VideoSongJob_Tests.cs @@ -195,10 +195,15 @@ public async Task ProcessVideoCanceled_Test() var job = GenerateJob(temp.Dir, div: 1); var cts = new CancellationTokenSource(); + var sw = System.Diagnostics.Stopwatch.StartNew(); + var task = job.ProcessAsync(cts.Token); + Console.WriteLine($"started: {sw.ElapsedMilliseconds}ms"); cts.Cancel(); + Console.WriteLine($"cancelled: {sw.ElapsedMilliseconds}ms"); var result = await task.ConfigureAwait(false); + Console.WriteLine($"awaited: {sw.ElapsedMilliseconds}ms"); result.IsSuccess.Should().BeNull(); result.Should().BeOfType(); }