#!/usr/bin/env python3
"""Harmless fixture: emit session-style command identity and hold for /proc read."""

from __future__ import annotations

import shlex
import signal
import sys
from pathlib import Path


def session_command_identity() -> str:
    return shlex.join(
        [sys.executable, str(Path(sys.argv[0]).resolve()), *sys.argv[1:]],
    )


def main() -> None:
    def on_term(_signum, _frame) -> None:
        raise SystemExit(0)

    signal.signal(signal.SIGTERM, on_term)
    signal.signal(signal.SIGINT, on_term)

    print(session_command_identity(), flush=True)
    try:
        sys.stdin.read(1)
    except OSError:
        pass


if __name__ == "__main__":
    main()
