From 71e7a99764f72f615345c6832f8d9834b9adc629 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 3 Mar 2025 14:17:14 +0100 Subject: [PATCH] Improve checking 7-zip exit code --- PhpManager/private/Expand-ArchiveWith7Zip.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PhpManager/private/Expand-ArchiveWith7Zip.ps1 b/PhpManager/private/Expand-ArchiveWith7Zip.ps1 index 3fc906c..722811b 100644 --- a/PhpManager/private/Expand-ArchiveWith7Zip.ps1 +++ b/PhpManager/private/Expand-ArchiveWith7Zip.ps1 @@ -59,6 +59,12 @@ throw "7-Zip executable not found at $sevenZipPath" } $sevenZipResult = & $sevenZipPath $sevenZipArguments + if ($null -eq $LASTEXITCODE) { + if ($sevenZipResult) { + throw "Extraction with 7-zip didn't set LASTEXITCODE; its output is $sevenZipResult" + } + throw "Extraction with 7-zip didn't set LASTEXITCODE" + } if ($LASTEXITCODE -ne 0) { if ($createdHere) { try {