Fix has_stdin() misfiring on non-interactive shells (/dev/null stdin)#6254
Open
Fix has_stdin() misfiring on non-interactive shells (/dev/null stdin)#6254
has_stdin() misfiring on non-interactive shells (/dev/null stdin)#6254Conversation
…ull stdin Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Utils\has_stdin() misfire in non-interactive shells
Fix Mar 2, 2026
has_stdin() misfiring on non-interactive shells (/dev/null stdin)
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
swissspidy
reviewed
Mar 3, 2026
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.
Utils\has_stdin()incorrectly returnstruein cron/atd/puppet environments where STDIN is connected to/dev/null.stream_select()with timeout=0 returns 1 for/dev/nullbecause EOF is immediately readable in POSIX terms — indistinguishable from a stream with actual data.Changes
php/utils.php: Prepend anfstat(STDIN)check beforestream_select(). If the file type bits indicate a character device (S_IFCHR = 0020000) — which covers both TTYs and/dev/null— returnfalseimmediately. Pipes and regular files fall through to the existingstream_select()path.tests/UtilsTest.php: Two subprocess tests verifying the boundary cases:has_stdin()returnsfalsewhen STDIN is/dev/nullhas_stdin()returnstruewhen data is actually pipedWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/usr/bin/php php vendor/bin/phpunit --color=always --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php rc/Type/PHPUnit/MockForIntersectionDynamicReturnTypeExtension.php rc/Type/PHPUnit/DynamicCallToAssertionIgnoreExtension.php rc/Type/PHPUnit/MockBuilderDynamicReturnTypeExtension.php rc/Rules/PHPUnitiptables rc/Rules/PHPUnit-w rc/Rules/PHPUnit-t rc/Rules/PHPUnitsecurity rc/R�� rc/Rules/PHPUnitOUTPUT rc/Rules/PHPUnit-d(dns block)nosuchhost_asdf_asdf_asdf.com/usr/bin/php php vendor/bin/phpunit --color=always --bootstrap ./vendor/wp-cli/wp-cli-tests/tests/bootstrap.php rc/Type/PHPUnit/MockForIntersectionDynamicReturnTypeExtension.php rc/Type/PHPUnit/DynamicCallToAssertionIgnoreExtension.php rc/Type/PHPUnit/MockBuilderDynamicReturnTypeExtension.php rc/Rules/PHPUnitiptables rc/Rules/PHPUnit-w rc/Rules/PHPUnit-t rc/Rules/PHPUnitsecurity rc/R�� rc/Rules/PHPUnitOUTPUT rc/Rules/PHPUnit-d(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Utils\has_stdin()misfires depending on shell environment entity-command#164✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.