Skip to content

test(source): regression for sourced fn with fd3 block redirect + procsub while-read#1345

Merged
chaliy merged 1 commit intomainfrom
claude/kind-mayer-9aFm0
Apr 19, 2026
Merged

test(source): regression for sourced fn with fd3 block redirect + procsub while-read#1345
chaliy merged 1 commit intomainfrom
claude/kind-mayer-9aFm0

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 19, 2026

Summary

Issue #1343 reported that a sourced function mixing { ... } 3>&1 >"$file" with a while read; done < <(ls glob) loop produced an empty output file — the while body never ran.

On current main this 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

  • New spec case source_function_fd3_block_redirect_with_procsub_while_read in crates/bashkit/tests/spec_cases/bash/source.test.sh
  • Test creates /tmp/issue1343_dir/*.txt, sources a file defining myfunc, calls it, then asserts both the fd3 progress stream on stdout and the >file contents populated by the while read loop

Test plan

  • New spec case passes (cargo test --test spec_tests bash_spec_tests)
  • All 1978 bash spec tests green (0 failed, 25 skipped)
  • Expected output verified against real bash — identical
  • cargo fmt --check clean
  • cargo clippy --all-targets --all-features -- -D warnings clean

Closes #1343

…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
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@chaliy chaliy merged commit b376cde into main Apr 19, 2026
23 checks passed
@chaliy chaliy deleted the claude/kind-mayer-9aFm0 branch April 19, 2026 01:14
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(interpreter): sourced function with 3>&1 >file and < <(cmd) produces empty output

1 participant