Skip to content

Commit d87abd7

Browse files
committed
fix: handled permission errors on windows
1 parent b3e9224 commit d87abd7

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

update-all-repos.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,12 @@ function Get-GitRepos {
100100
if ($Depth -eq 1) {
101101
Write-Host " Scanning $Path" -ForegroundColor Gray
102102
}
103-
if (Test-Path (Join-Path $Path ".git")) {
104-
$script:ReposFoundList.Add($Path) | Out-Null
103+
try {
104+
if (Test-Path (Join-Path $Path ".git") -ErrorAction SilentlyContinue) {
105+
$script:ReposFoundList.Add($Path) | Out-Null
106+
}
107+
} catch {
108+
# Silently skip paths we don't have permission to read
105109
}
106110
if ($MaxDepth -gt 0 -and $Depth -ge $MaxDepth) { return }
107111
Get-ChildItem -Path $Path -Directory -ErrorAction SilentlyContinue | ForEach-Object {

0 commit comments

Comments
 (0)