Skip to content

Bash c stdin was available to all commands vs. just the first one#105

Merged
cramforce merged 5 commits intovercel-labs:mainfrom
robertyates:bash-c-stdin-fix
Feb 10, 2026
Merged

Bash c stdin was available to all commands vs. just the first one#105
cramforce merged 5 commits intovercel-labs:mainfrom
robertyates:bash-c-stdin-fix

Conversation

@robertyates
Copy link
Copy Markdown
Contributor

@robertyates robertyates commented Feb 9, 2026

when data is piped into a bash script only the first command in the group should consume the data piped into the script

what was happening is that if a pipe was empty then it would fallback to the group stdin and this violates the expected behaviour for bash

e.g.

echo "test" | bash -c \'RESULT=$(cat | grep "nomatch" | head -1); echo "RESULT=[$RESULT]"\'

head should have received an empty input but instead it got "test" piped into the group, with this fix only the first command gets the bash -c piped input

the PR includes a failing test case and a fix that allows the test case to pass

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 9, 2026

@robertlyates is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@robertyates robertyates changed the title Bash c stdin fix Bash c stdin was available to all commands vs. just the first one Feb 10, 2026
@robertyates
Copy link
Copy Markdown
Contributor Author

@cramforce hopefully an easy merge, in more testing I discovered a bug / spec violation in my original PR - #102

the test case in here demonstrates the failure and then there's an easy fix, again, somewhat urgent on my side, appreciate all you're doing here

@cramforce cramforce merged commit 330fee5 into vercel-labs:main Feb 10, 2026
7 of 9 checks passed
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.

3 participants