Skip to content

Fix STDIN consumption in alias groups for eval-file#86

Closed
Copilot wants to merge 7 commits intomainfrom
copilot/fix-stdin-input-alias-group
Closed

Fix STDIN consumption in alias groups for eval-file#86
Copilot wants to merge 7 commits intomainfrom
copilot/fix-stdin-input-alias-group

Conversation

Copy link
Contributor

Copilot AI commented Feb 15, 2026

Fix STDIN input with alias groups for eval-file command

  • Add static cache property to store STDIN contents
  • Modify execute_eval method to cache STDIN on first read
  • Use STDIN inode+device as cache key for cross-process sharing
  • Reuse cached STDIN for subsequent reads in alias groups
  • Add automatic cleanup of stale cache files (older than 1 hour)
  • Fallback to parent PID or environment variable when fstat unavailable
  • Pass all code quality checks (lint, phpcs, phpstan)
  • Fix test to verify STDIN executes on both sites in alias group
  • Fix cache sharing issue - all subprocesses now share the same cache file
Original prompt

This section details on the original issue you should resolve

<issue_title>Input from STDIN does not work with an alias group</issue_title>
<issue_description>cat cleanup_stuff.php | wp @site_a eval-file - works.
But it does not work if used with a alias group.
It only triggers on the first entry of the alias group.
eval-file alias

</issue_description>

Comments on the Issue (you are @copilot in this section)

@janw-me I also took alook at the output when adding the `--debug` flag. I'm willing to look into it but am uncertain where to start. @janw-me PS a dirty hack workaround I found out is misusing the regular `eval` command:

wp @blueprint eval "$(tail -n +2 cleanup.php )"</comment_new>
<comment_new>@schlessera
Oh, I assume STDIN is being read per site for the group, so after the first run, the empty STDIN is being read.

Not sure how we should go about for this, I'll have to do a bit of exploration here.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 15, 2026 17:18
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix STDIN input handling for alias group Fix STDIN consumption in alias groups for eval-file Feb 15, 2026
Copilot AI requested a review from swissspidy February 15, 2026 17:29
@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 51.06383% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/EvalFile_Command.php 51.06% 23 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy marked this pull request as ready for review March 11, 2026 08:34
@swissspidy swissspidy requested a review from a team as a code owner March 11, 2026 08:34
Copilot AI review requested due to automatic review settings March 11, 2026 08:34

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
@swissspidy
Copy link
Member

Closing in favor of wp-cli/wp-cli#6278

@swissspidy swissspidy closed this Mar 17, 2026
@swissspidy swissspidy deleted the copilot/fix-stdin-input-alias-group branch March 17, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Input from STDIN does not work with an alias group

3 participants