Repository navigation
fix(curl): inherit stdin so -d @- / -T - / --data-binary @- work (fixes #4084) - #4370
TechWizard9999 wants to merge 2 commits into
Conversation
Without stdin inheritance, cmd.output() gives the child an immediate-EOF stdin, causing curl to read an empty body for -d @-, -T -, --data-binary @-, -F field=@-, -K -. This mirrors the existing pattern in npm_cmd.rs / wc_cmd.rs (RunOptions::inherit_stdin). Fixes rtk-ai#4084.
…hinks it's unused)
📊 Automated PR Analysis
SummaryFixes rtk curl dropping request bodies when using stdin-reading forms like -d @-, -T -, --data-binary @-, -F field=@-, or -K -. The root cause was that cmd.output() gives the child process immediate-EOF stdin, so the fix adds cmd.stdin(Stdio::inherit()) before spawning curl, mirroring the existing pattern in npm_cmd.rs and wc_cmd.rs. Review Checklist
Linked issues: #4084 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
|
Hi @KuSh , Could you please review this ? |
|
Thanks for picking this up, @TechWizard9999. #4085 makes the same change ( |
Summary
Fixes #4084:
rtk curl -d @-(and-T -,--data-binary @-,-F field=@-,-K -) sends an empty body because the child process gets an immediate-EOF stdin.Root Cause
curl_cmd::run()spawns curl viacmd.output()without configuring stdin. Per std's documented behavior,output()gives the child an immediate-EOF stdin. curl's@-forms read from stdin, so they receive EOF → empty body.Fix
Added
cmd.stdin(std::process::Stdio::inherit())beforecmd.output()incurl_cmd::run(). This mirrors the existing pattern innpm_cmd.rs/wc_cmd.rs(RunOptions::inherit_stdin()).Covers all stdin-reading forms:
-d @-,-T -,--data-binary @-,-F field=@-,-K -.Testing
curl_cmd.rsstill passecho '{"test":1}' | rtk curl -d @- ...now sends the body instead of LEN=0