Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions crates/bashkit/src/builtins/jq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,9 @@ impl Builtin for Jq {
}
}

// Ensure output ends with newline if there's output (for consistency)
if !output.is_empty() && !output.ends_with('\n') {
// Ensure output ends with newline if there's output (for consistency),
// but not when -j/--join-output is set (it suppresses trailing newline).
if !join_output && !output.is_empty() && !output.ends_with('\n') {
output.push('\n');
}

Expand Down
3 changes: 2 additions & 1 deletion crates/bashkit/tests/spec_cases/jq/jq.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,9 @@ echo '{"a":1}' | jq --tab '.'
### end

### jq_join_output
# Join output mode suppresses newlines between outputs
# Join output mode suppresses newlines between and after outputs
echo '["a","b"]' | jq -j '.[]'
printf '\n'
### expect
ab
### end
Expand Down
Loading