Skip to content

Commit

Permalink
feat: add cancellation token check
Browse files Browse the repository at this point in the history
  • Loading branch information
guitarrapc committed Sep 26, 2023
1 parent 06dabe2 commit cafa1c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/UnityBuildRunner.Core/DefaultBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public async Task BuildAsync(CancellationToken ct = default)
var waitingLongTime = false;
while (!process.HasExited)
{
ct.ThrowIfCancellationRequested();

if (File.Exists(settings.LogFilePath)) break;

// Log waiting message.
Expand Down Expand Up @@ -114,6 +116,8 @@ public async Task BuildAsync(CancellationToken ct = default)
// read logs and redirect to stdout
while (!process.HasExited)
{
ct.ThrowIfCancellationRequested();

ReadAndFilterLog(reader, errorFilter);
await Task.Delay(TimeSpan.FromMilliseconds(500), ct).ConfigureAwait(false);
}
Expand Down

0 comments on commit cafa1c1

Please sign in to comment.