367 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
27 lines
1.3 KiB
Python
27 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Replace only our local test auth-provider process after a verified build."""
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import signal
|
|
import subprocess
|
|
import time
|
|
ROOT=Path(__file__).resolve().parents[1]
|
|
SERVER=Path('/home/praxis/Projects/WoW-Hybrid/servers/trinity-forever')
|
|
info=json.loads((ROOT/'secrets/forever-local/account.json').read_text())
|
|
if not (Path(info['recovery'])/'bnetserver').exists(): raise RuntimeError('original provider binary recovery copy missing')
|
|
pid=int((ROOT/'runtime/bnet-provider.pid').read_text())
|
|
if Path(f'/proc/{pid}/comm').read_text().strip()!='bnetserver': raise RuntimeError('test provider PID changed')
|
|
os.kill(pid,signal.SIGTERM)
|
|
for _ in range(100):
|
|
if not Path(f'/proc/{pid}').exists(): break
|
|
time.sleep(.05)
|
|
else: raise RuntimeError('provider did not stop')
|
|
binary=SERVER/'install/bin/bnetserver'; shutil.copy2(SERVER/'build/bin/Release/bin/bnetserver',binary)
|
|
fd=os.open(ROOT/'runtime/bnet-provider.log',os.O_WRONLY|os.O_CREAT|os.O_APPEND,0o600)
|
|
with os.fdopen(fd,'ab') as log:
|
|
p=subprocess.Popen([str(binary),'-c',str(SERVER/'install/etc/bnetserver.conf')],cwd=SERVER/'install/bin',stdout=log,stderr=subprocess.STDOUT,start_new_session=True)
|
|
(ROOT/'runtime/bnet-provider.pid').write_text(str(p.pid))
|
|
print('Restarted only local test auth provider; pid',p.pid)
|