Repository navigation
fix: piped input on macOS and extension-less paths like <(cmd) (#30) - #31
Merged
Merged
Conversation
cargo test never opens a terminal, so it cannot catch #30: with stdin piped, crossterm reads keys from /dev/tty, and on macOS that fails at startup with "Failed to initialize input reader". `script` gives the app a pty; the data comes down the pipe and `q` arrives through the tty. Expected to fail until the fix lands — this commit is the reproduction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Enable crossterm's use-dev-tty feature. Without it the event source waits on /dev/tty through kqueue, which macOS does not support for terminals, so any piped input died with "Failed to initialize input reader". - A path with no extension (process substitution hands over /dev/fd/N) is identified from its content, the same way stdin is, instead of failing with "Unsupported file format: .". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #30.
/dev/tty, and by default it waits on that through kqueue, which macOS doesn't support for terminals. Every piped input (not just JSON) died withFailed to initialize input reader. Enabling crossterm'suse-dev-ttyfeature fixes it.datasight <(cmd)./dev/fd/Nhas no extension, so loading failed withUnsupported file format: .. Extension-less paths now detect the format from the content, the same way stdin does.Testing.
cargo testnever opens a terminal, so CI couldn't catch this. A new macOS-only step runs the binary inside a pty viascript, with the JSON piped in andqsent through the terminal. The first commit adds only that step, so it should fail and reproduce the bug; the second commit has the fix and should turn it green. On Linux:cargo test(375) andqa.sh(193, including a new<(...)case) pass.