"""Read a saved park through the pinned engine in an isolated verifier profile.""" import argparse import json import os from pathlib import Path import selectors import shutil import subprocess import tempfile import time def reopen(park, engine="openrct2", rct2="/opt/rct2-assets"): with tempfile.TemporaryDirectory(prefix="t39-reopen-") as temp: profile=Path(temp) (profile/"plugin").mkdir() observer=Path(__file__).with_name("native-inspect.js") shutil.copy2(observer,profile/"plugin/observer.js") # The base plot is a converted copy; no RCT1 installation is needed. command=[engine,str(park.resolve()),"--headless","--rct2-data-path",rct2, "--user-data-path",temp] child=subprocess.Popen(command,stdout=subprocess.PIPE,stderr=subprocess.STDOUT, bufsize=0) output=b"" try: selector=selectors.DefaultSelector() selector.register(child.stdout,selectors.EVENT_READ) deadline=time.monotonic()+90 while time.monotonic()