← Back to PRs

#8038: fix(exec): use spawnWithFallback to handle EBADF on macOS

by FelixFoster open 2026-02-03 14:03 View on GitHub →
size: S
Fixes #8021. ## The Problem On macOS with Node.js 22+, throws when trying to inherit stdin in a background/daemon context. The existing has logic to handle this, but was bypassing it by calling directly. ## The Fix Updated in to use . Added a specific fallback strategy: if is 'inherit', try again with 'ignore' upon failure. ## Verification This ensures that the tool (which uses ) benefits from the same robustness as other spawn sites in the codebase. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates process execution to route `runCommandWithTimeout` through the existing `spawnWithFallback` helper so it can recover from macOS Node 22+ `EBADF` when inheriting stdin in daemon/background contexts. It adds a targeted fallback that retries with `stdin: "ignore"` when the initial spawn uses `stdin: "inherit"`, and it also tweaks cron scheduling logic to ensure overdue jobs arm the timer immediately and one-shot jobs remain runnable until successfully completed. <h3>Confidence Score: 4/5</h3> - This PR looks safe to merge and aligns with existing spawn retry patterns, with only minor cleanup suggested. - Core change (routing `runCommandWithTimeout` through `spawnWithFallback` and adding an stdin inherit→ignore retry) is consistent with existing `EBADF` handling and keeps behavior identical on success. The main actionable issue spotted is an unused `spawn` import that may fail lint/tsc, plus a small logging-consistency suggestion. - src/process/exec.ts <!-- greptile_other_comments_section --> <sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs