From 96c1c0653d753adafc9e26d91628d5356fd2e343 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 9 Aug 2025 20:04:50 +0200 Subject: [PATCH] Fixed Windows pipeline (#529) --- .github/workflows/build-and-release.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index d1cc72fe..8d1d8de4 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -362,7 +362,10 @@ jobs: $PDFIUM_URL = "https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F$($env:PDFIUM_VERSION)/pdfium-$PDFIUM_FILE" Write-Host "Download $PDFIUM_URL ..." - $TMP = New-TemporaryFile | Split-Path + + # Create a unique temporary directory (not just a file) + $TMP = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName()) + New-Item -ItemType Directory -Path $TMP -Force | Out-Null $ARCHIVE = Join-Path $TMP "pdfium.tgz" Invoke-WebRequest -Uri $PDFIUM_URL -OutFile $ARCHIVE @@ -380,8 +383,15 @@ jobs: Copy-Item -Path $SRC -Destination $DEST -Force Write-Host "Cleaning up ..." - Remove-Item $ARCHIVE -Force - Remove-Item $TMP -Recurse -Force + Remove-Item $ARCHIVE -Force -ErrorAction SilentlyContinue + + # Try to remove the temporary directory, but ignore errors if files are still in use + try { + Remove-Item $TMP -Recurse -Force -ErrorAction Stop + Write-Host "Successfully cleaned up temporary directory: $TMP" + } catch { + Write-Warning "Could not fully clean up temporary directory: $TMP. This is usually harmless as Windows will clean it up later. Error: $($_.Exception.Message)" + } - name: Build .NET project run: |