Skip to content

Commit f2a3e35

Browse files
committed
🤖 Log full terminal command invocation in backend
Add log.info() before spawning terminal processes on all platforms: - macOS: logs 'open -a Ghostty <path>' or 'open -a Terminal <path>' - Windows: logs 'cmd /c start cmd /K cd /D <path>' - Linux: logs '<terminal> <args>' with optional cwd info This helps debug terminal launching issues by showing exactly what command is being executed. Generated with `cmux`.
1 parent 28df03f commit f2a3e35

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/services/ipcMain.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,22 +621,31 @@ export class IpcMain {
621621
const terminal = this.findAvailableCommand(["ghostty", "terminal"]);
622622
if (terminal === "ghostty") {
623623
// Match main: pass workspacePath to 'open -a Ghostty' to avoid regressions
624-
const child = spawn("open", ["-a", "Ghostty", workspacePath], {
624+
const cmd = "open";
625+
const args = ["-a", "Ghostty", workspacePath];
626+
log.info(`Opening terminal: ${cmd} ${args.join(" ")}`);
627+
const child = spawn(cmd, args, {
625628
detached: true,
626629
stdio: "ignore",
627630
});
628631
child.unref();
629632
} else {
630633
// Terminal.app opens in the directory when passed as argument
631-
const child = spawn("open", ["-a", "Terminal", workspacePath], {
634+
const cmd = "open";
635+
const args = ["-a", "Terminal", workspacePath];
636+
log.info(`Opening terminal: ${cmd} ${args.join(" ")}`);
637+
const child = spawn(cmd, args, {
632638
detached: true,
633639
stdio: "ignore",
634640
});
635641
child.unref();
636642
}
637643
} else if (process.platform === "win32") {
638644
// Windows
639-
const child = spawn("cmd", ["/c", "start", "cmd", "/K", "cd", "/D", workspacePath], {
645+
const cmd = "cmd";
646+
const args = ["/c", "start", "cmd", "/K", "cd", "/D", workspacePath];
647+
log.info(`Opening terminal: ${cmd} ${args.join(" ")}`);
648+
const child = spawn(cmd, args, {
640649
detached: true,
641650
shell: true,
642651
stdio: "ignore",
@@ -660,13 +669,16 @@ export class IpcMain {
660669
const availableTerminal = terminals.find((t) => this.isCommandAvailable(t.cmd));
661670

662671
if (availableTerminal) {
672+
const cwdInfo = availableTerminal.cwd ? ` (cwd: ${availableTerminal.cwd})` : "";
673+
log.info(
674+
`Opening terminal: ${availableTerminal.cmd} ${availableTerminal.args.join(" ")}${cwdInfo}`
675+
);
663676
const child = spawn(availableTerminal.cmd, availableTerminal.args, {
664677
cwd: availableTerminal.cwd ?? workspacePath,
665678
detached: true,
666679
stdio: "ignore",
667680
});
668681
child.unref();
669-
log.info(`Opened terminal ${availableTerminal.cmd} at ${workspacePath}`);
670682
} else {
671683
log.error(
672684
"No terminal emulator found. Tried: " + terminals.map((t) => t.cmd).join(", ")

0 commit comments

Comments
 (0)