Conversation
When quiet is false and stdio is piped, each data event wrote the whole accumulated stdout/stderr buffer instead of the new chunk, so earlier output was printed again every time the child wrote more. Write only the received chunk.
There was a problem hiding this comment.
🎉 Thanks for your first contribution to Valdi!
A maintainer will review your PR soon. Here are a few things to check while you wait:
- ✅ All tests pass (
bazel test //...) - ✅ Your changes follow our coding standards
- ✅ You've added tests for your changes (if applicable)
- ✅ You've updated documentation (if needed)
Ask in GitHub Discussions if you have questions!
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.
Description
Root cause: in
npm_modules/cli/src/utils/cliUtils.ts,spawnCliCommandappends everydatachunk to thestdout/stderrbuffers and then, whenquietis false, writes the whole buffer toprocess.stdout/process.stderrinstead of the chunk it just received. Every new chunk therefore prints all previous output again. Withstdio: 'pipe'andquiet: false(for exampleinstallAndroidApkandstartAndroidActivityindeviceUtils.ts, which runadb installandadb shell am start), a command that writesfirstand latersecondshowsfirst first secondin the terminal.Fix: write only the received chunk (
data). The accumulated buffers returned inCommandResultare unchanged.Type of Change
Testing
bazel test //...)Testing Details
Added
src/utils/cliUtils.spec.ts, which runsecho first; sleep 0.5; echo secondthroughspawnCliCommandwith'pipe'andquiet: false, and checks what was written toprocess.stdout.Before the fix:
After the fix:
npm testinnpm_modules/clihas no new failures, and eslint and prettier pass on the changed files.Checklist
Related Issues
None.
Additional Context
Two lines changed in
cliUtils.ts, plus the new spec.