Fix affected stdin terminal detection#2555
Conversation
9f420b1 to
ac20881
Compare
|
@DominicVonk Unfortunately this is a breaking change. |
|
Sorry, currently still working on it |
ac20881 to
3f4874b
Compare
12cab8f to
e0ed010
Compare
e0ed010 to
94df1ba
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR prevents query changed-files from auto-reading stdin when running in an interactive terminal (avoiding hangs waiting for EOF), and adds a CLI integration test to ensure affected projects can be selected via stdin when input is piped.
Changes:
- Gate stdin auto-read on whether stdin is a terminal (
!stdin().is_terminal()). - Add an integration test covering
query affectedreading file paths from stdin.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/cli/tests/query_affected_test.rs | Adds coverage for piping a file path via stdin to query affected. |
| crates/app/src/queries/changed_files.rs | Avoids blocking for stdin in interactive terminals by only reading stdin when non-terminal. |
| // Only auto-read stdin for piped input, otherwise interactive terminals hang waiting for EOF. | ||
| stdin: !stdin().is_terminal(), |
| local: !ci, | ||
| stdin: true, | ||
| // Only auto-read stdin for piped input, otherwise interactive terminals hang waiting for EOF. | ||
| stdin: !stdin().is_terminal(), |
Merging this PR will degrade performance by 44.22%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | hash_files[1000] |
9.8 ms | 17.6 ms | -44.22% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing DominicVonk:fix-changed-files-stdin-terminal (94df1ba) with master (2f3491e)
Unable to generate the flame graphsThe performance report has correctly been generated, but there was an internal error while generating the flame graphs for this run. We're working on fixing the issue. Feel free to contact us on Discord or at support@codspeed.io if the issue persists. |
|
@DominicVonk We already have checks around stdin here: https://github.com/moonrepo/moon/blob/master/crates/app/src/queries/changed_files.rs#L189 What issues are you running into exactly? |
|
I have also the same problem, our environment is azure devops pipelines. When running without this faketty it will wait in an endless loop. |
|
This exact problem our current workaround is to pipe /dev/null as stdin |
|
|
|
Yes, indeed. I will debug further and update the PR |
Summary
moon query affectedconsuming changed files from stdin.Validation
git diff --checkcargoandrustfmtare not installed in this container.