mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 00:49:03 +00:00
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** For #36111 The updates in https://github.com/fleetdm/fleet/pull/36111 caused some tests to start failing. I ran the suggested script: ``` go test ./pkg/file/... -update ``` and verified that the changes match the changes in the above PR [here](https://github.com/fleetdm/fleet/pull/36111/files#diff-09e225a2a28fbf997ddf571274119a20d9210539e5bdd49749beb2226e6de5aa).
22 lines
660 B
Text
22 lines
660 B
Text
$product_code = $PACKAGE_ID
|
|
$timeoutSeconds = 300 # 5 minute timeout
|
|
|
|
# Fleet uninstalls app using product code that's extracted on upload
|
|
$process = Start-Process msiexec -ArgumentList @("/quiet", "/x", $product_code, "/norestart") -PassThru
|
|
|
|
# Wait for process with timeout
|
|
$completed = $process.WaitForExit($timeoutSeconds * 1000)
|
|
|
|
if (-not $completed) {
|
|
Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
|
|
Exit 1603 # ERROR_UNINSTALL_FAILURE
|
|
}
|
|
|
|
# Check exit code and output result
|
|
if ($process.ExitCode -eq 0) {
|
|
Write-Output "Exit 0"
|
|
Exit 0
|
|
} else {
|
|
Write-Output "Exit $($process.ExitCode)"
|
|
Exit $process.ExitCode
|
|
}
|