Skip to content

Commit 054194f

Browse files
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]
1 parent 40dcfe4 commit 054194f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/borg/cockpit/runner.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ async def start(self):
2828
self.logger.warning("Borg process already running.")
2929
return
3030

31-
cmd = [sys.executable, "-m", "borg"] + self.command
31+
if getattr(sys, "frozen", False):
32+
cmd = [sys.executable] + self.command # executable == pyinstaller binary
33+
else:
34+
cmd = [sys.executable, "-m", "borg"] + self.command # executable == python interpreter
3235

3336
self.logger.info(f"Starting Borg process: {cmd}")
3437

0 commit comments

Comments
 (0)