Skip to content

Allow OCLIF_STDIN_TIMEOUT_MS environment variable to override hard-coded stdin read timeout #1646

Description

@ns-091

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions