Commit 9a2caf2
authored
fix(builtins): produce empty JSON string for jq -Rs with empty stdin (#971)
## Summary
- Fix `jq -Rs '.'` producing no output on empty stdin instead of `""`
- Root cause: early return when `input.trim().is_empty()` fired before
the `-Rs` code path could create an empty string value
- Added `&& !(raw_input && slurp)` guard so `-Rs` with empty stdin
proceeds to create `Val::from("")`
## Test plan
- [x] New spec test: `jq_raw_slurp_empty_stdin` — verifies `printf '' |
jq -Rs '.'` outputs `""`
- [x] New spec test: `jq_raw_slurp_normal` — regression test for
non-empty input
- [x] All 121 existing jq spec tests pass
- [x] Full spec test suite green
Closes #9521 parent 7bfefd2 commit 9a2caf2
File tree
2 files changed
+23
-1
lines changed- crates/bashkit
- src/builtins
- tests/spec_cases/jq
2 files changed
+23
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | | - | |
| 415 | + | |
| 416 | + | |
416 | 417 | | |
417 | 418 | | |
418 | 419 | | |
| |||
1361 | 1362 | | |
1362 | 1363 | | |
1363 | 1364 | | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
1364 | 1372 | | |
1365 | 1373 | | |
1366 | 1374 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1000 | 1000 | | |
1001 | 1001 | | |
1002 | 1002 | | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
0 commit comments