"""A provider waits on a driver-owned release file, bounded to protect cleanup."""
import pathlib
import sys
import time

gate = pathlib.Path(sys.argv[1])
gate.with_suffix(".entered").touch()
deadline = time.monotonic() + 1200
while not gate.exists():
    if time.monotonic() > deadline:
        raise SystemExit("gate expired without driver release")
    time.sleep(0.25)
print("gate released")
