Skip to content

Commit 5abbe09

Browse files
committed
🤖 debug: filter out noisy git status commands from logging
1 parent 6830ba3 commit 5abbe09

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

src/node/runtime/LocalBaseRuntime.ts

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,13 @@ export abstract class LocalBaseRuntime implements Runtime {
7777
cwd: spawnCwd,
7878
} = getPreferredSpawnConfig(command, cwd);
7979

80-
// Debug logging for Windows WSL issues
81-
log.info(`[LocalBaseRuntime.exec] Original command: ${command}`);
82-
log.info(`[LocalBaseRuntime.exec] Original cwd: ${cwd}`);
83-
log.info(`[LocalBaseRuntime.exec] Spawn command: ${bashCommand}`);
84-
log.info(`[LocalBaseRuntime.exec] Spawn args: ${JSON.stringify(bashArgs)}`);
85-
log.info(`[LocalBaseRuntime.exec] Spawn cwd: ${spawnCwd}`);
80+
// Debug logging for Windows WSL issues (skip noisy git status commands)
81+
const isGitStatusCmd = command.includes("git status") || command.includes("show-branch") || command.includes("PRIMARY_BRANCH");
82+
if (!isGitStatusCmd) {
83+
log.info(`[LocalBaseRuntime.exec] Original command: ${command.substring(0, 100)}${command.length > 100 ? "..." : ""}`);
84+
log.info(`[LocalBaseRuntime.exec] Spawn command: ${bashCommand}`);
85+
log.info(`[LocalBaseRuntime.exec] Spawn args: ${JSON.stringify(bashArgs).substring(0, 200)}...`);
86+
}
8687

8788
// If niceness is specified on Unix/Linux, spawn nice directly to avoid escaping issues
8889
// Windows doesn't have nice command, so just spawn bash directly
@@ -132,15 +133,17 @@ export abstract class LocalBaseRuntime implements Runtime {
132133
let timedOut = false;
133134
let aborted = false;
134135

135-
// Debug: log raw stdout/stderr from the child process
136+
// Debug: log raw stdout/stderr from the child process (only for non-git-status commands)
136137
let debugStdout = "";
137138
let debugStderr = "";
138-
childProcess.stdout?.on("data", (chunk: Buffer) => {
139-
debugStdout += chunk.toString();
140-
});
141-
childProcess.stderr?.on("data", (chunk: Buffer) => {
142-
debugStderr += chunk.toString();
143-
});
139+
if (!isGitStatusCmd) {
140+
childProcess.stdout?.on("data", (chunk: Buffer) => {
141+
debugStdout += chunk.toString();
142+
});
143+
childProcess.stderr?.on("data", (chunk: Buffer) => {
144+
debugStderr += chunk.toString();
145+
});
146+
}
144147

145148
// Create promises for exit code and duration
146149
// Uses special exit codes (EXIT_CODE_ABORTED, EXIT_CODE_TIMEOUT) for expected error conditions
@@ -150,11 +153,13 @@ export abstract class LocalBaseRuntime implements Runtime {
150153
// which causes hangs when users spawn background processes like servers.
151154
// The 'exit' event fires when the main bash process exits, which is what we want.
152155
childProcess.on("exit", (code) => {
153-
log.info(`[LocalBaseRuntime.exec] Process exited with code: ${code}`);
154-
log.info(`[LocalBaseRuntime.exec] stdout length: ${debugStdout.length}`);
155-
log.info(`[LocalBaseRuntime.exec] stdout: ${debugStdout.substring(0, 500)}${debugStdout.length > 500 ? "..." : ""}`);
156-
if (debugStderr) {
157-
log.info(`[LocalBaseRuntime.exec] stderr: ${debugStderr.substring(0, 500)}${debugStderr.length > 500 ? "..." : ""}`);
156+
if (!isGitStatusCmd) {
157+
log.info(`[LocalBaseRuntime.exec] Process exited with code: ${code}`);
158+
log.info(`[LocalBaseRuntime.exec] stdout length: ${debugStdout.length}`);
159+
log.info(`[LocalBaseRuntime.exec] stdout: ${debugStdout.substring(0, 500)}${debugStdout.length > 500 ? "..." : ""}`);
160+
if (debugStderr) {
161+
log.info(`[LocalBaseRuntime.exec] stderr: ${debugStderr.substring(0, 500)}${debugStderr.length > 500 ? "..." : ""}`);
162+
}
158163
}
159164
// Clean up any background processes (process group cleanup)
160165
// This prevents zombie processes when scripts spawn background tasks

0 commit comments

Comments
 (0)