Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -3953,6 +3953,10 @@ private void CopyFileInfoItem(FileInfo file, string destinationPath, bool force,
WriteError(new ErrorRecord(unAuthorizedAccessException, "CopyFileInfoItemUnauthorizedAccessError", ErrorCategory.PermissionDenied, file));
}
}
catch (IOException ioException)
{
WriteError(new ErrorRecord(ioException, "CopyFileInfoItemIOError", ErrorCategory.WriteError, file));
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

Describe "Validate Copy-Item locally" -Tags "CI" {
It "Copy-Item has non-terminating error if destination is in use" -Skip:(!$IsWindows) {
Copy-Item -Path $env:windir\system32\cmd.exe -Destination TestDrive:\
$cmd = Start-Process -FilePath TestDrive:\cmd.exe -PassThru
try {
{ Copy-Item -Path $env:windir\system32\cmd.exe -Destination TestDrive:\ -ErrorAction SilentlyContinue } | Should -Not -Throw
}
finally {
$cmd | Stop-Process
}
}
}

# This is a Pester test suite to validate Copy-Item remotely using a remote session.

# If PS Remoting is not available, do not run the suite.
Expand Down