Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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