Repository navigation
feat(read): fill out more of read builtin - #914
Merged
Merged
Conversation
Public API changes for crate: brush-coreAdded itemsPerformance Benchmark Report
Code Coverage Report: Only Changed Files listed
Minimum allowed coverage is Test Summary: bash-completion test suite
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR significantly expands the read builtin implementation to support timeout functionality (-t option), raw mode (-r option), and fixes several IFS (Internal Field Separator) splitting edge cases. The implementation adds comprehensive polling support for Unix platforms with appropriate stubs for Windows and WASM.
Key changes:
- Implements timeout support for
read -twith fractional second precision - Implements raw mode (
-r) to disable backslash escape processing - Fixes IFS splitting logic to correctly handle consecutive delimiters and preserve original delimiters in remainder fields
- Adds 150+ new integration test cases covering edge cases
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| brush-shell/tests/cases/builtins/read.yaml | Removes known_failure marker from trailing delimiter test; adds 150+ comprehensive test cases for timeout, raw mode, -N vs -n options, exit codes, IFS edge cases, and backslash processing |
| brush-core/src/sys/unix/poll.rs | New file implementing file descriptor polling with timeout support using nix's poll interface, handles EINTR correctly |
| brush-core/src/sys/stubs/poll.rs | New stub implementation returning "Unsupported" error for platforms without poll support |
| brush-core/src/sys/unix.rs | Exports new poll module |
| brush-core/src/sys/windows.rs | Exports stubbed poll module for Windows |
| brush-core/src/sys/wasm.rs | Exports stubbed poll module for WASM |
| brush-core/src/sys/stubs.rs | Adds poll module to stubs |
| brush-core/src/sys.rs | Re-exports platform-specific poll module |
| brush-core/src/openfiles.rs | Changes try_borrow_as_fd visibility from pub(crate) to pub to support poll module |
| brush-core/Cargo.toml | Adds "poll" feature to nix dependency |
| brush-builtins/src/read.rs | Major refactoring: implements timeout logic, raw mode, refactors IFS splitting with correct edge case handling, adds helper structs (InputReader, LineReaderConfig), adds comprehensive documentation and 120+ lines of unit tests |
Test Results 3 files 29 suites 12m 18s ⏱️ Results for commit cd67518. ♻️ This comment has been updated with latest results. |
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.
No description provided.