Skip to content

fix: piped input on macOS and extension-less paths like <(cmd) (#30) - #31

Merged
SpollaL merged 2 commits into
mainfrom
fix/piped-input-30
Oct 16, 2026
Merged

SpollaL merged 2 commits into
mainfrom
fix/piped-input-30

Conversation

@SpollaL

@SpollaL SpollaL commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Fixes #30.

  • Piped stdin on macOS. With stdin taken by the pipe, crossterm reads keys from /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 with Failed to initialize input reader. Enabling crossterm's use-dev-tty feature fixes it.
  • datasight <(cmd). /dev/fd/N has no extension, so loading failed with Unsupported file format: .. Extension-less paths now detect the format from the content, the same way stdin does.

Testing. cargo test never opens a terminal, so CI couldn't catch this. A new macOS-only step runs the binary inside a pty via script, with the JSON piped in and q sent 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) and qa.sh (193, including a new <(...) case) pass.

SpollaL and others added 2 commits October 15, 2026 08:35
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>
@SpollaL
SpollaL merged commit 3217a62 into main Oct 16, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Piped JSON input fails with “Failed to initialize input reader” on macOSFailed to initialize input reader on MacOs

1 participant