diff --git a/sealoader_gui.py b/sealoader_gui.py index 7d4b59a..67a4461 100644 --- a/sealoader_gui.py +++ b/sealoader_gui.py @@ -902,16 +902,19 @@ class SeaLoaderApp(tk.Tk): # Create updater PowerShell script ps_path = os.path.join(tmpdir, 'sealoader_updater.ps1') - ps = f""" + pid_val = os.getpid() + target_val = current_exe.replace("'", "''") + source_val = new_exe_path.replace("'", "''") + ps = """ $ErrorActionPreference = 'Stop' -$pidToWait = {os.getpid()} -$target = '{current_exe}'.Replace("'","''") -$source = '{new_exe_path}'.Replace("'","''") -while (Get-Process -Id $pidToWait -ErrorAction SilentlyContinue) { Start-Sleep -Milliseconds 200 } +$pidToWait = {pid} +$target = '{target}'.Replace("'","''") +$source = '{source}'.Replace("'","''") +while (Get-Process -Id $pidToWait -ErrorAction SilentlyContinue) {{ Start-Sleep -Milliseconds 200 }} Move-Item -Force -LiteralPath $source -Destination $target Start-Process -FilePath $target Remove-Item -LiteralPath $PSCommandPath -Force -""" +""".format(pid=pid_val, target=target_val, source=source_val) with open(ps_path, 'w', encoding='utf-8') as f: f.write(ps)