Skip to content

Commit 54cc32f

Browse files
Fix shallow clone deepening hanging in CI (#36)
* Fix shallow clone deepening hanging in CI execSync with stdio: "pipe" created a pipe for stdin, causing git to hang if a credential helper tried to prompt for input. Additionally, execSync blocks the event loop, so the global setTimeout timeout could never fire — leaving no safety net for hanging fetches. Fix by setting stdin to "ignore" (so git can't block on input) and adding a 30s timeout directly on execSync (enforced at OS level via SIGTERM, independent of the event loop). Fixes LIN-62864 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Log error --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 11302fa commit 54cc32f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/git.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,14 @@ export function ensureCommitAvailable(sha: string, cwd: string = process.cwd()):
227227
for (const { command, label } of strategies) {
228228
verbose(label);
229229
try {
230-
execSync(command, { cwd, stdio: "pipe" });
230+
execSync(command, { cwd, stdio: ["ignore", "ignore", "pipe"], timeout: 30_000 });
231231
if (commitExists(sha, cwd)) {
232232
verbose(`Found commit ${sha}`);
233233
return;
234234
}
235-
} catch {
236-
// Strategy failed, try next
235+
} catch (e) {
236+
const reason = e instanceof Error ? e.message : String(e);
237+
verbose(`Strategy "${label}" failed: ${reason}`);
237238
}
238239
}
239240

0 commit comments

Comments
 (0)