Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cli/src/agents/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ export class ACP {
env: { ...process.env, ...(config.env ?? {}) },
stdio: ["pipe", "pipe", "pipe"],
shell: useShell,
// A shell-backed spawn allocates its own console window on Windows,
// which flashes on screen and can steal focus. No-op elsewhere.
windowsHide: true,
},
);

Expand Down
1 change: 1 addition & 0 deletions cli/src/agents/codex-readonly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export async function readCodexThread(
const child = spawn(command, ["app-server", "--stdio"], {
cwd,
stdio: ["pipe", "pipe", "pipe"],
windowsHide: true,
});

let stderr = "";
Expand Down
1 change: 1 addition & 0 deletions cli/src/filesystem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ export function initFilesystemHandler(conn: Connection, rootDir: string) {
cwd: gitRoot,
encoding: "utf-8",
stdio: ["pipe", "pipe", "pipe"], // silence stderr
windowsHide: true,
});
} catch {
// File might not exist in HEAD (new file), return empty
Expand Down
23 changes: 14 additions & 9 deletions cli/src/notify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,21 @@ function escapePowerShell(s: string) {
}

function run(cmd: string, args: string[]) {
execFile(cmd, args, { timeout: 5000 }, (error, _stdout, stderr) => {
if (error) {
logger.debug(`${cmd} failed`, error);
return;
}
execFile(
cmd,
args,
{ timeout: 5000, windowsHide: true },
(error, _stdout, stderr) => {
if (error) {
logger.debug(`${cmd} failed`, error);
return;
}

if (stderr?.trim()) {
logger.debug(`${cmd} stderr: ${stderr.trim()}`);
}
});
if (stderr?.trim()) {
logger.debug(`${cmd} stderr: ${stderr.trim()}`);
}
},
);
}

export function notify({ title, body }: NotifyArgs): boolean {
Expand Down
10 changes: 8 additions & 2 deletions cli/src/ports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export function initPortsHandler(conn: Connection) {
output = execSync("netstat -ano | findstr LISTENING", {
encoding: "utf-8",
timeout: 5000,
windowsHide: true,
});

const lines = output.trim().split("\n");
Expand Down Expand Up @@ -211,7 +212,10 @@ export function initPortsHandler(conn: Connection) {
}
}
} else if (platform === "win32") {
const result = spawnSync("netstat", ["-ano"], { encoding: "utf-8" });
const result = spawnSync("netstat", ["-ano"], {
encoding: "utf-8",
windowsHide: true,
});
const lines = (result.stdout || "").trim().split("\n");
for (const line of lines) {
if (!line.includes("LISTENING")) continue;
Expand All @@ -221,7 +225,9 @@ export function initPortsHandler(conn: Connection) {
const p = parseInt(parts[4], 10);
if (localAddr.endsWith(`:${portNum}`)) {
if (pid === null) pid = p;
spawnSync("taskkill", ["/F", "/PID", String(p)]);
spawnSync("taskkill", ["/F", "/PID", String(p)], {
windowsHide: true,
});
}
}
}
Expand Down
1 change: 1 addition & 0 deletions cli/src/update-and-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function isShellularInstalledGlobally(): Promise<boolean> {
const child = spawn("npm", ["list", "-g", "shellular", "--depth=0"], {
stdio: "ignore",
shell: process.platform === "win32",
windowsHide: true,
});

child.on("close", (code) => {
Expand Down
1 change: 1 addition & 0 deletions cli/src/update-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export async function runSelfUpdate(): Promise<void> {
stdio: ["ignore", logFd, logFd],
cwd: config.SHELLULAR_DIR,
env: process.env,
windowsHide: true,
});
child.unref();
} else {
Expand Down
1 change: 1 addition & 0 deletions cli/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export function commandExists(command: string): boolean {
const result = spawnSync("where", [command], {
stdio: "ignore",
shell: false,
windowsHide: true,
});
return result.status === 0;
}
Expand Down