@@ -618,12 +618,22 @@ def cancel_callback():
618618 ppid = os .getppid () # main.py launches a subprocess for the main script, so we need the parent pid
619619 if globals .os is Os .Windows :
620620 script = "\n " .join ([
621- f"Wait-Process -Id { ppid } " , # main.py launches a subprocess for the main script, so we need the parent pid
621+ "try {"
622+ 'Write-Host "Waiting for F95Checker to quit..."' ,
623+ f"Wait-Process -Id { ppid } " ,
624+ 'Write-Host "Sleeping 3 seconds..."' ,
622625 "Start-Sleep -Seconds 3" ,
626+ 'Write-Host "Deleting old version files..."' ,
623627 f"Get-ChildItem -Force -Recurse -Path { shlex .quote (str (dst ))} | Select-Object -ExpandProperty FullName | Sort-Object -Property Length -Descending | Remove-Item -Force -Recurse" ,
628+ 'Write-Host "Moving new version files..."' ,
624629 f"Get-ChildItem -Force -Path { shlex .quote (str (src ))} | Select-Object -ExpandProperty FullName | Move-Item -Force -Destination { shlex .quote (str (dst ))} " ,
630+ 'Write-Host "Sleeping 3 seconds..."' ,
625631 "Start-Sleep -Seconds 3" ,
626- f"& { globals .start_cmd } "
632+ 'Write-Host "Starting F95Checker..."' ,
633+ f"& { globals .start_cmd } " ,
634+ "} catch {" ,
635+ 'Write-Host "An error occurred:`n" $_.InvocationInfo.PositionMessage "`n" $_' ,
636+ "}" ,
627637 ])
628638 shell = [shutil .which ("powershell" )]
629639 else :
@@ -641,9 +651,12 @@ def cancel_callback():
641651 except Exception :
642652 pass
643653 script = "\n " .join ([
654+ shlex .join (["echo" , "Waiting for F95Checker to quit..." ]),
644655 shlex .join (["tail" , "--pid" , str (ppid ), "-f" , os .devnull ] if globals .os is Os .Linux else ["lsof" , "-p" , str (ppid ), "+r" , "1" ]),
645- "sleep 3" ,
646- globals .start_cmd
656+ shlex .join (["echo" , "Sleeping 3 seconds..." ]),
657+ shlex .join (["sleep" , "3" ]),
658+ shlex .join (["echo" , "Starting F95Checker..." ]),
659+ globals .start_cmd ,
647660 ])
648661 shell = [shutil .which ("bash" ) or shutil .which ("zsh" ) or shutil .which ("sh" ), "-c" ]
649662 if macos_app :
0 commit comments