Skip to content

Commit

Permalink
fix copy cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
danmoseley committed Jun 26, 2023
1 parent 29397b5 commit 92f3600
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Tasks/Copy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,18 @@ internal bool Execute(

// Use single-threaded code path when requested or when there is only copy to make
// (no need to create all the parallel infrastructure for that case).
bool success = parallelism == 1 || DestinationFiles.Length == 1
? CopySingleThreaded(copyFile, out destinationFilesSuccessfullyCopied)
: CopyParallel(copyFile, parallelism, out destinationFilesSuccessfullyCopied);
bool success = false;

try
{
success = parallelism == 1 || DestinationFiles.Length == 1
? CopySingleThreaded(copyFile, out destinationFilesSuccessfullyCopied)
: CopyParallel(copyFile, parallelism, out destinationFilesSuccessfullyCopied);
}
catch (OperationCanceledException)
{
return false;
}

// copiedFiles contains only the copies that were successful.
CopiedFiles = destinationFilesSuccessfullyCopied.ToArray();
Expand Down

0 comments on commit 92f3600

Please sign in to comment.