-
Notifications
You must be signed in to change notification settings - Fork 5k
console: retry on EAGAIN instead of dropping output when stdout is nonblocking #33560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
robobun
wants to merge
12
commits into
main
Choose a base branch
from
farm/53d355d1/stdout-nonblock-loss
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+106
−1
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ff28f3f
console: do not drop output on EAGAIN when stdout is nonblocking
robobun 9cca594
test: drop misleading pipeline exit-code assertion
robobun f647c86
test: cover 1 MiB single-line shape; move cases out of concurrent block
robobun 735e326
tighten doc comment on fd_write_all_quiet
robobun c993caa
ci: retrigger
robobun a8f370c
FileSink: actually clear O_NONBLOCK in ForceFileSinkToBeSynchronous
robobun 2a82767
[autofix.ci] apply automated fixes
autofix-ci[bot] 2023d1f
sys: bail out of fd_write_all_quiet on poll() error
robobun fdaeb6b
test: assert inherited-stdout child actually ran
robobun 73ff61e
test: add isolating case for the fd_write_all_quiet EAGAIN path
robobun ebc63ae
test: delay the reader in the writer-isolating case
robobun 7d5bb80
Drop the FileSink change; pin process.stdout.write staying async
robobun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9410,6 +9410,21 @@ | |
| match write(fd, bytes) { | ||
| Ok(0) => return false, // short write → give up | ||
| Ok(n) => bytes = &bytes[n..], | ||
| #[cfg(unix)] | ||
| Err(e) if e.get_errno() == E::EINTR => continue, | ||
| #[cfg(unix)] | ||
| Err(e) if e.get_errno() == E::EAGAIN => { | ||
| // fd 1/2 may be O_NONBLOCK once `process.stdout`/`stderr` is | ||
| // materialized; block until writable instead of dropping bytes. | ||
| let mut pfd = [posix::PollFd { | ||
| fd: fd.native() as core::ffi::c_int, | ||
| events: posix::POLL_OUT, | ||
| revents: 0, | ||
| }]; | ||
| if posix::poll(&mut pfd, -1).is_err() { | ||
| return false; | ||
| } | ||
| } | ||
|
Check warning on line 9427 in src/sys/lib.rs
|
||
|
coderabbitai[bot] marked this conversation as resolved.
robobun marked this conversation as resolved.
robobun marked this conversation as resolved.
|
||
| Err(_) => return false, | ||
| } | ||
| } | ||
|
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.