From ce182652adabd4c4b5f7d49608a3dee72047ce33 Mon Sep 17 00:00:00 2001 From: anti Date: Sat, 11 Apr 2026 19:42:10 -0400 Subject: [PATCH] fix(cli): add __main__ guard so python -m decnet.cli actually runs the app MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The collector subprocess was spawned via 'python3 -m decnet.cli collect' but cli.py had no 'if __name__ == __main__: app()' guard. Python executed the module, defined all functions, then exited cleanly with code 0 without ever calling the collect command. No output, no log file, exit 0 — silent non-start every time. Also route collector stderr to .collector.log so future crashes are visible instead of disappearing into DEVNULL. --- decnet/cli.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/decnet/cli.py b/decnet/cli.py index 1660c2f..7e4841d 100644 --- a/decnet/cli.py +++ b/decnet/cli.py @@ -401,10 +401,12 @@ def deploy( if effective_log_file and not dry_run and not api: import subprocess # noqa: F811 # nosec B404 import sys + _collector_err = Path(effective_log_file).with_suffix(".collector.log") console.print(f"[bold cyan]Starting log collector[/] → {effective_log_file}") subprocess.Popen( # nosec B603 [sys.executable, "-m", "decnet.cli", "collect", "--log-file", str(effective_log_file)], - stdout=subprocess.DEVNULL, + stdin=subprocess.DEVNULL, + stdout=open(_collector_err, "a"), # nosec B603 stderr=subprocess.STDOUT, start_new_session=True, ) @@ -613,3 +615,6 @@ def serve_web( httpd.serve_forever() except KeyboardInterrupt: console.print("\n[dim]Shutting down dashboard server.[/]") + +if __name__ == '__main__': # pragma: no cover + app()