From 0b598b43a71ac27da516d87eecd4541c8ca0ca68 Mon Sep 17 00:00:00 2001 From: Ryan Kistner Date: Sun, 3 Nov 2019 16:50:52 -0700 Subject: [PATCH] Ensure failed download task throws OperationCanceledException so that the return code is reported correctly when it is the last task --- DepotDownloader/ContentDownloader.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index fc4c8ae4..0015ee95 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -898,9 +898,11 @@ namespace DepotDownloader { Console.WriteLine( "Failed to find any server with chunk {0} for depot {1}. Aborting.", chunkID, depot.id ); cts.Cancel(); - return; } + // Throw the cancellation exception if requested so that this task is marked failed + cts.Token.ThrowIfCancellationRequested(); + TotalBytesCompressed += chunk.CompressedLength; DepotBytesCompressed += chunk.CompressedLength; TotalBytesUncompressed += chunk.UncompressedLength;