File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
test/tools/Modules/HelpersCommon Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -326,19 +326,16 @@ function Test-CanWriteToPsHome
326
326
return $script :CanWriteToPsHome
327
327
}
328
328
329
- $script :CanWriteToPsHome = $true
329
+ $script :CanWriteToPsHome = $false
330
330
331
331
try {
332
332
$testFileName = Join-Path $PSHOME (New-Guid ).Guid
333
333
$null = New-Item - ItemType File - Path $testFileName - ErrorAction Stop
334
+ $script :CanWriteToPsHome = $true
335
+ Remove-Item - Path $testFileName - ErrorAction SilentlyContinue
334
336
}
335
- catch [System.UnauthorizedAccessException ] {
336
- $script :CanWriteToPsHome = $false
337
- }
338
- finally {
339
- if ($script :CanWriteToPsHome ) {
340
- Remove-Item - Path $testFileName - ErrorAction SilentlyContinue
341
- }
337
+ catch {
338
+ ; # do nothing
342
339
}
343
340
344
341
$script :CanWriteToPsHome
You can’t perform that action at this time.
0 commit comments