test(source): regression for sourced fn with fd3 block redirect + procsub while-read#1345
Merged
test(source): regression for sourced fn with fd3 block redirect + procsub while-read#1345
Conversation
…csub while-read Issue #1343 reported that a sourced function using `{...} 3>&1 >file` plus `while read; done < <(ls glob)` produced an empty output file. Verified on current main that #1341 (glob inside process substitution) already resolves this. Add a spec case that exercises the exact pattern so a regression is caught before it ships. Closes #1343
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | b2faec5 | Commit Preview URL Branch Preview URL |
Apr 19 2026, 01:03 AM |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
Issue #1343 reported that a sourced function mixing
{ ... } 3>&1 >"$file"with awhile read; done < <(ls glob)loop produced an empty output file — the while body never ran.On current
mainthis pattern already works: PR #1341 (glob inside<(...)) resolved the underlying cause. This PR adds a spec case that exercises the exact shape from the issue so any future regression is caught before shipping.What
source_function_fd3_block_redirect_with_procsub_while_readincrates/bashkit/tests/spec_cases/bash/source.test.sh/tmp/issue1343_dir/*.txt, sources a file definingmyfunc, calls it, then asserts both the fd3 progress stream on stdout and the>filecontents populated by thewhile readloopTest plan
cargo test --test spec_tests bash_spec_tests)cargo fmt --checkcleancargo clippy --all-targets --all-features -- -D warningscleanCloses #1343