Skip to content

Add FileHandle.read(until:) to avoid blocking on slow exit test events.#1782

Merged
grynspan merged 2 commits into
mainfrom
jgrynspan/read-until
Jul 10, 2026
Merged

Add FileHandle.read(until:) to avoid blocking on slow exit test events.#1782
grynspan merged 2 commits into
mainfrom
jgrynspan/read-until

Conversation

@grynspan

@grynspan grynspan commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

If an exit test runs for a long time, we necessarily block until it terminates before the calling task resumes. We also wait until the end of the exit test to consume any events from its event stream (by calling FileHandle.readToEnd() and thus waiting for the write end of the pipe to close).

This PR breaks up reading from the exit test's event stream so that we read one line at a time, then yield before processing the event. The result is that we process events sooner after they occur and we allow other tasks to use the thread we're camped on at least for a little bit of time.

I'll also be able to use read(until:) in the harness.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

…nts.

If an exit test runs for a long time, we necessarily block until it terminates
before the calling task resumes. We also wait until the end of the exit test to
consume any events from its event stream (by calling `FileHandle.readToEnd()`
and thus waiting for the write end of the pipe to close).

This PR breaks up reading from the exit test's event stream so that we read one
line at a time, then yield before processing the event. The result is that we
process events sooner after they occur and we allow other tasks to use the
thread we're camped on at least for a little bit of time.
@grynspan grynspan added this to the Swift 6.5.0 (main) milestone Jul 9, 2026
@grynspan grynspan self-assigned this Jul 9, 2026
@grynspan grynspan added the performance 🏎️ Performance issues label Jul 9, 2026
@grynspan grynspan requested a review from harlanhaskins as a code owner July 9, 2026 20:56
@grynspan grynspan added exit-tests ☠️ Work related to exit tests command-line experience ⌨️ enhancements to the command line interface harness 🪢 Changes related to the testing harness labels Jul 9, 2026
@grynspan

Copy link
Copy Markdown
Contributor Author

Linux failures are known issues.

@grynspan grynspan merged commit bc78a2d into main Jul 10, 2026
30 of 33 checks passed
@grynspan grynspan deleted the jgrynspan/read-until branch July 10, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command-line experience ⌨️ enhancements to the command line interface exit-tests ☠️ Work related to exit tests harness 🪢 Changes related to the testing harness performance 🏎️ Performance issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants