Allow OCLIF_STDIN_TIMEOUT_MS environment variable to override hard-coded stdin read timeout
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 316
- Forks
- 98
- Avg merge
- 12h 32m
- Merged PRs (30d)
- 2
Description
Is your feature request related to a problem? Please describe.
When piping input into a command that uses allowStdin, the command intermittently fails with Flag --FlagName expects a value. This happens because readStdin() in parse has a hard-coded 10ms timeout, and on loaded systems or CI runners piped data frequently doesn't arrive within that window.
src/parser/parse - readStdin()
const timeout = setTimeout(() => ac.abort(), 10)
Describe the solution you'd like
Add support for an OCLIF_STDIN_TIMEOUT_MS environment variable that overrides the hard-coded 10 in readStdin(), defaulting to the current value when not set. This lets users and CI pipelines opt in to a longer timeout without changing default behavior for anyone else.
Describe alternatives you've considered
Third-party CI tools and GitHub Actions that wrap CLI pipe values directly into flags that use allowStdin and have no way to configure the timeout. Users of those tools can't easily work around the issue without forking the action or switching to a different auth method entirely.
Additional context
The fix is a one-liner in @oclif/core/lib/parser/parse. The issue affects any oclif flag using allowStdin and is most reliably reproduced in CI environments where process spawn overhead makes sub-10ms stdin delivery uncommon
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/parser/parse at readStdin(), where the 10ms AbortController timeout is set; the built package path is @oclif/core/lib/parser/parse. Verify the environment variable overrides that value while the default remains 10ms, then confirm piping into an allowStdin flag works with the configured timeout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 87/100