| Line | Text | Actions |
|---|
| 1 | from pathlib import Path | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 2 | import ctypes, subprocess, sys, time | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 3 | ROOT=Path(__file__).resolve().parents[1] | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 4 | sys.path.insert(0,str(ROOT)) | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 5 | import sheet_relay as sr | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 6 | OLD_PID=13236 | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 7 | WRAPPER=ROOT/'projects'/'low_latency_relay_v3test.py' | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 8 | probe=subprocess.run(['powershell','-NoProfile','-Command',f"$p=Get-CimInstance Win32_Process -Filter 'ProcessId={OLD_PID}' -ErrorAction SilentlyContinue; if($p){{$p.CommandLine}}"],capture_output=True,text=True,check=False) | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 9 | cmd=probe.stdout.strip(); print('OLD_CMD='+cmd,flush=True) | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 10 | if 'low_latency_relay_v3test.py' not in cmd: raise SystemExit('PID_GUARD_FAILED') | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 11 | k=subprocess.run(['taskkill','/PID',str(OLD_PID),'/F'],capture_output=True,text=True,check=False); print('TASKKILL_RC='+str(k.returncode),flush=True) | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 12 | if k.returncode!=0: raise SystemExit('KILL_FAILED') | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 13 | new=None | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 14 | try: | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 15 | time.sleep(12.0) | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 16 | cfg=sr.require_config() | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 17 | for i in range(1,6): | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 18 | t=time.perf_counter(); status,data=sr.http_json(sr.web_app_url(cfg,'poll'),timeout=45); ms=(time.perf_counter()-t)*1000 | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 19 | print(f'POLL_{i}_STATUS={status} RTT_MS={ms:.1f} COMMAND={bool(data.get("command"))}',flush=True) | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 20 | finally: | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 21 | flags=getattr(subprocess,'CREATE_NO_WINDOW',0) | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 22 | new=subprocess.Popen([sys.executable,str(WRAPPER)],cwd=str(ROOT),stdin=subprocess.DEVNULL,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL,creationflags=flags) | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 23 | time.sleep(2) | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 24 | try: ok=bool(ctypes.windll.kernel32.SetPriorityClass(int(new._handle),0x00008000)) | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 25 | except Exception: ok=False | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |
| 26 | print('RESTART_PID='+str(new.pid),flush=True); print('PRIORITY_ABOVE_NORMAL='+str(ok),flush=True) | Use FILE Use as OLD Use as NEW Open Patch Composer +/-3 CONTEXT +/-10 CONTEXT +/-25 CONTEXT Append to Buffer A |