Repository navigation
Settle spawnAsync on close so stdout/stderr are fully read - #1271
Merged
Merged
Conversation
exit can fire before the stdio pipes are drained, so a fast failing command could reject with empty stderr (bitwarden then reported 'unknown' instead of re-unlocking). Settle on close instead, falling back 500ms after exit for children that leave a daemon holding the pipes.
Contributor
|
The changes in this PR will be included in the next version bump.
|
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: Reviewed subprocess settlement, affected CLI callers, and regression coverage.
- Output collection:
spawnAsyncHelpernow settles onclose, preserving stdout/stderr received afterexit. - Bounded fallback: A guarded 500 ms fallback settles and destroys captured streams when descendants keep the pipes open.
- Regression coverage: Tests exercise delayed stdout/stderr and lingering descendants, with patch releases recorded for affected packages.
Validation passed: all 19 utils tests, utils typecheck, and all six subprocess tests under Bun. Additional Bun probes covered ENOENT, mixed stdio, and a 4 MiB output round trip. Validation was Linux-only; vendor CLIs were not exercised.
gpt-6.1-sol | 𝕏
varlock
@varlock/astro-integration
@varlock/cloudflare-integration
@varlock/nuxt-integration
@varlock/vite-integration
@varlock/native-helper-darwin
@varlock/native-helper-linux-arm64
@varlock/native-helper-linux-x64
@varlock/native-helper-win32-x64
@varlock/1password-plugin
@varlock/bitwarden-plugin
@varlock/keepass-plugin
@varlock/pass-plugin
@varlock/proton-pass-plugin
commit: |
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.



spawnAsyncHelpersettled on the child'sexitevent, which can fire before the stdio pipes are drained. Under load a failing command could reject with empty stderr: bitwarden then couldn't recognize "Vault is locked.", skipped its re-unlock retry, and reportedunknown(seen flaking in CI on #1269). Successful calls could likewise lose trailing stdout.Now it settles on
close. Since a child that leaves a background daemon holding its pipes (eg.op) would never fireclose, it falls back 500ms afterexit, settling with whatever arrived and destroying the streams.Tests reproduce the gap deterministically: the child exits immediately and a grandchild sharing its stdio writes 100ms later (old code returns empty output), plus a check that a lingering daemon doesn't hang the call.