v1.8.90: fix update script — remove $ErrorActionPreference=Stop, launch via cmd start
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -272,24 +272,23 @@ class UpdateChecker:
|
||||
exe_dir = os.path.dirname(current_exe)
|
||||
|
||||
ps_content = f"""
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$pid = {pid}
|
||||
$src = '{new_exe}'
|
||||
$dst = '{current_exe}'
|
||||
$mei = '{mei_dir}'
|
||||
$exeDir = '{exe_dir}'
|
||||
$tempDir = '{tmp_dir}'
|
||||
|
||||
# Wait for old process to exit
|
||||
while (Get-Process -Id $pid -ErrorAction SilentlyContinue) {{
|
||||
Start-Sleep -Seconds 1
|
||||
}}
|
||||
Start-Sleep -Seconds 2
|
||||
Start-Sleep -Seconds 3
|
||||
|
||||
# Clean ALL stale _MEI directories (PyInstaller temp dirs)
|
||||
Get-ChildItem -Path $tempDir -Directory -Filter '_MEI*' -ErrorAction SilentlyContinue | ForEach-Object {{
|
||||
Remove-Item -Path $_.FullName -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}}
|
||||
# Clean ALL stale _MEI directories (best-effort, skip locked)
|
||||
try {{
|
||||
Get-ChildItem -Path $tempDir -Directory -Filter '_MEI*' -ErrorAction SilentlyContinue | ForEach-Object {{
|
||||
Remove-Item -Path $_.FullName -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}}
|
||||
}} catch {{}}
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
# Copy with retry
|
||||
@@ -311,8 +310,8 @@ if (-not $copied) {{ exit 1 }}
|
||||
|
||||
Start-Sleep -Seconds 2
|
||||
|
||||
# Launch new exe via explorer.exe (mimics user double-click, clean environment)
|
||||
Start-Process explorer.exe $dst
|
||||
# Launch new exe via cmd start (clean environment, proper path handling)
|
||||
Start-Process cmd.exe -ArgumentList '/c', 'start', '""', ('"{0}"' -f $dst) -WindowStyle Hidden
|
||||
|
||||
# Cleanup
|
||||
Start-Sleep -Seconds 3
|
||||
|
||||
Reference in New Issue
Block a user