Repository navigation
fix: report the timeout when a command succeeds past the deadline - #173
Open
ferdingler wants to merge 1 commit into
Open
ferdingler wants to merge 1 commit into
ferdingler wants to merge 1 commit into
Conversation
sleep stops at the deadline and exits 0, and the shell only checks the deadline before the next command. So a timed-out sleep at the end of a command line, after ||, or in a pipeline reported success with no error. Check the deadline after a command that exits 0 as well, so the timeout is reported once, with status 1.
This was referenced Oct 21, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Under a timeout,
sleep 5with a two second limit came back with status 0 and no error, as if it had slept the whole time. Sleep stops when the deadline hits, but the shell only notices the timeout before it starts the next command. So if the sleep was the last thing in the line, or sat behind||or in a pipeline, the timeout went unreported.Now the shell also checks the deadline right after a command that claims success, and reports the usual timeout error with status 1. I put the check in the shell rather than in sleep itself, because sleep can't stop the rest of the line, and if it printed the error the shell would print it a second time for whatever came next. Commands that already fail on the timeout (like Lua or a busy loop) behave the same as before. One thing I left alone: a timeout inside a subshell followed by another command still prints the error twice, same as a busy loop does there today.
I added a test that a sleep past the deadline fails with the timeout error, and a control that a short sleep under a generous timeout still succeeds. On main the first one fails; with the change both pass, and they ran clean five times in a row. The full Rust suite, the doc tests and the node-feature tests pass, and clippy shows no new warnings.
Related Issues
None.
Documentation PR
None.
Type of Change
Bug fix
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce new warnings.
cargo test --workspace --all-targets,pytest tests/python,npm test)cargo fmtandcargo clippyChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.