Skip to content

dbus_bridge

dbus_bridge

shield dbus-bridge entry point — standalone D-Bus bridge launcher.

Acquires the per-container well-known bus name on the session bus, creates a :class:~terok_shield.lib.dbus_bridge.ShieldBridge, and runs until SIGINT/SIGTERM. For orchestrated use (e.g. terok TUI), import :class:ShieldBridge directly and manage the bus externally.

run_dbus_bridge(state_dir, container)

Start the standalone D-Bus bridge for a container.

Acquires the per-container bus name, spawns the interactive subprocess, and relays events until interrupted.

Parameters:

Name Type Description Default
state_dir Path

Per-container state directory.

required
container str

Container name.

required

Raises:

Type Description
SystemExit

If the bus name cannot be acquired.

Source code in src/terok_shield/cli/dbus_bridge.py
def run_dbus_bridge(state_dir: Path, container: str) -> None:
    """Start the standalone D-Bus bridge for a container.

    Acquires the per-container bus name, spawns the interactive
    subprocess, and relays events until interrupted.

    Args:
        state_dir: Per-container state directory.
        container: Container name.

    Raises:
        SystemExit: If the bus name cannot be acquired.
    """
    try:
        asyncio.run(_run_bridge(state_dir, container))
    except KeyboardInterrupt:
        pass