From 568c2bd370c9d4231bc7be4781e04b6fe513d30b Mon Sep 17 00:00:00 2001 From: Greg Date: Mon, 5 Aug 2024 03:17:31 -0500 Subject: [PATCH] Delete output file if task is cancelled. --- OctaneEngine/Engine.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OctaneEngine/Engine.cs b/OctaneEngine/Engine.cs index a42748f..213495b 100644 --- a/OctaneEngine/Engine.cs +++ b/OctaneEngine/Engine.cs @@ -208,6 +208,11 @@ await Parallel.ForEachAsync(pieces, options, async (piece, token) => _config?.ProgressCallback?.Invoke((double)tasksDone / _config.Parts); }).ConfigureAwait(false); } + catch (OperationCanceledException ex) + { + logger.LogError("TASK WAS CANCELLED."); + File.Delete(filename); + } catch (Exception ex) { logger.LogError($"ERROR USING CORE CLIENT: {ex.Message}");