39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Wrapper script: generates opening brief report.
|
|
Hermes cron runner does not support script arguments, so this wrapper
|
|
calls generate_report.py with the 'opening_brief' argument.
|
|
"""
|
|
import sys
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
# ── 消息通道统一路由(broadcast/xmpp by delivery) ──
|
|
try:
|
|
from messenger import install_stdio_hook as _msh
|
|
_msh()
|
|
except Exception:
|
|
pass
|
|
|
|
script_dir = Path(__file__).parent.resolve()
|
|
target = script_dir / "generate_report.py"
|
|
|
|
if not target.exists():
|
|
print(f"ERROR: generate_report.py not found at {target}", file=sys.stderr)
|
|
sys.exit(1)
|
|
|
|
result = subprocess.run(
|
|
[sys.executable, str(target), "opening_brief"],
|
|
capture_output=True, text=True, timeout=120,
|
|
)
|
|
|
|
if result.stdout:
|
|
print(result.stdout.strip())
|
|
if result.returncode != 0:
|
|
error_msg = f"Script exited with code {result.returncode}"
|
|
if result.stderr:
|
|
error_msg += f"\nstderr:\n{result.stderr}"
|
|
print(error_msg, file=sys.stderr)
|
|
sys.exit(result.returncode)
|
|
if result.stderr:
|
|
print(f"stderr:\n{result.stderr}", file=sys.stderr)
|