Fix stderr to output string with no decoration (fix #2063)

This commit is contained in:
itchyny authored and Nico Williams committed 2023-07-23 17:06:00 -05:00
1 parent dfdce8c6e7
commit 98f709d0c1
5 files changed
+47 -2

No files matched your search

+15
View File
@@ -49,6 +49,8 @@ struct jq_state {
void *input_cb_data;
jq_msg_cb debug_cb;
void *debug_cb_data;
jq_msg_cb stderr_cb;
void *stderr_cb_data;
};
struct closure {
@@ -1018,6 +1020,9 @@ jq_state *jq_init(void) {
jq->debug_cb = NULL;
jq->debug_cb_data = NULL;
jq->stderr_cb = NULL;
jq->stderr_cb_data = NULL;
jq->err_cb = default_err_cb;
jq->err_cb_data = stderr;
@@ -1249,6 +1254,16 @@ void jq_get_debug_cb(jq_state *jq, jq_msg_cb *cb, void **data) {
*data = jq->debug_cb_data;
}
void jq_set_stderr_cb(jq_state *jq, jq_msg_cb cb, void *data) {
jq->stderr_cb = cb;
jq->stderr_cb_data = data;
}
void jq_get_stderr_cb(jq_state *jq, jq_msg_cb *cb, void **data) {
*cb = jq->stderr_cb;
*data = jq->stderr_cb_data;
}
void
jq_halt(jq_state *jq, jv exit_code, jv error_message)
{