GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing github.com — Fix unblock read only file by iSazonov · Pull Request #4395 · PowerShell/PowerShell Conversation
|
|
Ilya (@iSazonov) what is the error message the user sees now? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
MSDN says that Unblock-File : Access is denied At line:1 char:1 + Unblock-File -Path $Testpath + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Unblock-File], Win32Exception + FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.UnblockFileCommand |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (!NativeMethods.DeleteFile(resultPath)) | ||
| { | ||
| int error = Marshal.GetLastWin32Error(); | ||
| throw new Win32Exception(error); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be a non-terminating error? The following should behave similarly:
dir | Unblock-File dir | Remove-Item
In the Remove-Item case, a read only file reports an error, but all other files are deleted.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
AlternateDataStreamUtilities uses the pattern. So maybe add try-catch in Unblock-File cmdlet file?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Jason Shirk (@lzybkr) Steve Lee (@SteveL-MSFT) Please continue the code review. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
A commit has been added to the review
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Make sure the final commit message points out this is a new non-terminating error.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Adds a new non-terminating error when a file is read-only
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.