From 054194f4cb9c577517a525484e08d63a02f24c44 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 14 Feb 2026 21:22:30 +0100 Subject: [PATCH] cockpit: fix subprocess invocation in frozen binaries When running as a Pyinstaller-made binary, sys.executable points to the borg binary itself. Invoking it with "-m borg" resulted in an incorrect command line (e.g., "borg -m borg ..."), which confused the argument parser in the subprocess. This change checks sys.frozen to determine the correct invocation: - If frozen: [sys.executable, ...args] - If not frozen: [sys.executable, "-m", "borg", ...args] --- src/borg/cockpit/runner.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/borg/cockpit/runner.py b/src/borg/cockpit/runner.py index 4fee38714..8119e6fb9 100644 --- a/src/borg/cockpit/runner.py +++ b/src/borg/cockpit/runner.py @@ -28,7 +28,10 @@ class BorgRunner: self.logger.warning("Borg process already running.") return - cmd = [sys.executable, "-m", "borg"] + self.command + if getattr(sys, "frozen", False): + cmd = [sys.executable] + self.command # executable == pyinstaller binary + else: + cmd = [sys.executable, "-m", "borg"] + self.command # executable == python interpreter self.logger.info(f"Starting Borg process: {cmd}")