I discovered why GNU timeout pauses when my Mac sleeps, so I wrote a drop-in replacement in Rust using mach_continuous_time
Hi everyone, I recently spent days debugging a flaky CI pipeline on our local macOS runners. Builds were hanging indefinitely despite having a strict timeout set. It turned out that the standard GNU timeout (installed via coreutils) relies on nanosleep() or select(). On Darwin kernels, these map to mach_absolute_time.
The catch? mach_absolute_time stops ticking when the system sleeps (i.e. closing the lid or entering standby). If your runner sleeps for an hour, your timeout is extended by an hour, which breaks the guarantee.
I couldn't find a native timeout tool that handled this correctly, so I built darwin-timeout. It uses the mach_continuous_time API via Kqueue (EVFILT_TIMER) to ensure the clock keeps ticking even during hibernation. It's also a perfect standalone drop-in replacement for timeout from GNU coreutils, with extra features, and matching performance.