Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion scripts/prepare-auto-reply-session-runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,9 @@ def stage_runtime(
f">>{shlex.quote(str(state_root / 'session-service/watchdog.out.log'))} "
f"2>>{shlex.quote(str(state_root / 'session-service/watchdog.err.log'))}\n"
"status=$?\n"
# No Apple Events here on purpose: asking Terminal to close its own\n # window triggered a per-binary Automation prompt on every restart.\n # Terminal closes the window itself when this shell exits.\n"exit \"$status\"\n"
# No Apple Events here on purpose: asking Terminal to close its own
# window triggered a per-binary Automation prompt on every restart.
'exit "$status"\n'
).encode("utf-8")
watchdog_path = runtime / "start-auto-reply-session.command"
created.append(watchdog_path)
Expand Down
26 changes: 26 additions & 0 deletions tests/test_auto_reply_session_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import plistlib
import shutil
import stat
import subprocess
import sys
import tempfile
import unittest
Expand Down Expand Up @@ -150,6 +151,31 @@ def test_stages_private_immutable_multi_room_runtime_without_activation(self):
self.assertFalse((state / "session-monitor-status.json").exists())
self.assertFalse((root / "Library/LaunchAgents").exists())

def test_session_command_exits_with_the_watchdog_status(self):
with tempfile.TemporaryDirectory() as temporary:
root = Path(temporary).resolve()
module, source, binary, config, python, state = self.fixture(root)
python.write_text("#!/bin/sh\nexit 7\n", encoding="utf-8")
result = module.stage_runtime(
binary=binary,
python=python,
config=config,
source_dir=source.resolve(),
state_root=state.resolve(),
runtime_parent=(state / "runtime").resolve(),
chats=("bind:42:Room One", "id:77"),
release_id="release-1",
start_interval=45,
)
watchdog = Path(result["runtime_root"]) / "start-auto-reply-session.command"
completed = subprocess.run(
["/bin/sh", str(watchdog)],
stdin=subprocess.DEVNULL,
capture_output=True,
timeout=30,
)
self.assertEqual(completed.returncode, 7)

def test_repository_runtime_asset_set_can_be_staged(self):
with tempfile.TemporaryDirectory() as temporary:
root = Path(temporary).resolve()
Expand Down
Loading