From 808f75dd9603d97c50dac12016238cc759af6345 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 16 Aug 2024 17:57:22 +0200 Subject: [PATCH] Ignore unfinished browser downloads --- scripts/Common/Scripts/BrowserAutomation.ps1 | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/Common/Scripts/BrowserAutomation.ps1 b/scripts/Common/Scripts/BrowserAutomation.ps1 index 1b3e1fc8..9dd153fb 100644 --- a/scripts/Common/Scripts/BrowserAutomation.ps1 +++ b/scripts/Common/Scripts/BrowserAutomation.ps1 @@ -68,19 +68,19 @@ $null = New-Module { $downloadChecker = { $files = Get-ChildItem $dir; - if ((@($files)).Count -gt 0) { - foreach ($file in $files) { - try { - $stream = [System.IO.File]::Open($file.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None); - - if ($stream) { - $stream.Close(); - } - } - catch { - return $true; + if ((@($files)).Count -eq 1) { + $file = $files[0]; + + try { + $stream = [System.IO.File]::Open($file.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None); + + if ($stream) { + $stream.Close(); } } + catch { + return $true; + } return $false; } else {