Skip to content

Commit de01520

Browse files
committed
fix: call ghostty directly for SSH terminals instead of using open --command
The issue was that using 'open -a Ghostty --args --command=...' would cause the terminal to exit immediately after the SSH command completes. Instead, call 'ghostty ssh ...' directly, which keeps the terminal open for the interactive SSH session. Generated with `mux`
1 parent 49873ed commit de01520

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/node/services/ipcMain.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,16 +1753,17 @@ export class IpcMain {
17531753
// macOS - try Ghostty first, fallback to Terminal.app
17541754
const terminal = await this.findAvailableCommand(["ghostty", "terminal"]);
17551755
if (terminal === "ghostty") {
1756-
const cmd = "open";
1756+
let cmd: string;
17571757
let args: string[];
17581758
if (isSSH && sshArgs) {
1759-
// Ghostty: Use --command flag to run SSH
1760-
// Build the full SSH command as a single string
1761-
const sshCommand = ["ssh", ...sshArgs].join(" ");
1762-
args = ["-n", "-a", "Ghostty", "--args", `--command=${sshCommand}`];
1759+
// Ghostty: Call ghostty directly with SSH command
1760+
// This ensures the terminal stays open for the interactive SSH session
1761+
cmd = "ghostty";
1762+
args = ["ssh", ...sshArgs];
17631763
} else {
1764-
// Ghostty: Use -n to open new window, pass working directory via --args
1764+
// Ghostty: Use open with working directory for local terminals
17651765
if (config.type !== "local") throw new Error("Expected local config");
1766+
cmd = "open";
17661767
args = ["-n", "-a", "Ghostty", "--args", `--working-directory=${config.workspacePath}`];
17671768
}
17681769
log.info(`Opening ${logPrefix}: ${cmd} ${args.join(" ")}`);

0 commit comments

Comments
 (0)