INNER CODE UNIT · Python
_run
browser-use/bux · agent/box_agent.py:450
def _run(args: list[str]) -> int:
# box-agent already runs as bux (systemd User=bux), so direct
# /usr/bin/tmux invocations share the same default socket as
# the pty child. No sudo gymnastics needed.
try:
return subprocess.run(
['/usr/bin/tmux', *args],
stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
timeout=5,
).returncode
except Exception:
return 1
# `has-session` exits 0 if the window exists. Cheap probe.
exists = _run(['has-session', '-t', window_id]) == 0
if exists: