Fix --raw-input
This commit is contained in:
1 parent
cca3e92854
commit
7a295b30e0
1 file changed
+4
-1
@@ -193,13 +193,16 @@ static jv next_input(jq_state *jq, void *data) {
|
|||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
if (options & SLURP) {
|
if (options & SLURP) {
|
||||||
state->slurped = jv_string_concat(state->slurped, jv_string(state->buf));
|
state->slurped = jv_string_concat(state->slurped, jv_string(state->buf));
|
||||||
} else if (jv_is_valid(value)) {
|
} else {
|
||||||
|
if (!jv_is_valid(value))
|
||||||
|
value = jv_string("");
|
||||||
if (state->buf[len-1] == '\n') {
|
if (state->buf[len-1] == '\n') {
|
||||||
// whole line
|
// whole line
|
||||||
state->buf[len-1] = 0;
|
state->buf[len-1] = 0;
|
||||||
return jv_string_concat(value, jv_string(state->buf));
|
return jv_string_concat(value, jv_string(state->buf));
|
||||||
}
|
}
|
||||||
value = jv_string_concat(value, jv_string(state->buf));
|
value = jv_string_concat(value, jv_string(state->buf));
|
||||||
|
state->buf[0] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user