fix summary cleanup

This commit is contained in:
Oliver Kieselbach
2026-03-09 20:18:09 +01:00
parent dc411d112e
commit 7aee1d57c7
2 changed files with 5 additions and 2 deletions
@@ -1 +1 @@
378
381
@@ -170,9 +170,12 @@ namespace AutopilotMonitor.SummaryDialog
// PowerShell Wait-Process: waits for our actual process exit (no polling),
// then short delay for file handle cleanup, then Remove-Item.
// Two-pass delete: -Recurse clears contents, second call removes the
// now-empty folder (Windows/PowerShell timing issue can leave it behind).
var psScript = $"Wait-Process -Id {pid} -Timeout 30 -ErrorAction SilentlyContinue; " +
$"Start-Sleep -Seconds 2; " +
$"Remove-Item -LiteralPath '{exeDir}' -Recurse -Force -ErrorAction SilentlyContinue";
$"Remove-Item -LiteralPath '{exeDir}' -Recurse -Force -ErrorAction SilentlyContinue; " +
$"Remove-Item -LiteralPath '{exeDir}' -Force -ErrorAction SilentlyContinue";
var encoded = Convert.ToBase64String(Encoding.Unicode.GetBytes(psScript));
// Full path to powershell.exe — don't rely on PATH resolution