summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmanuele Torre <torreemanuele6@gmail.com>2023-07-07 18:06:58 +0200
committerNico Williams <nico@cryptonector.com>2023-07-07 11:13:28 -0500
commitcd8898d5b95cbf082da000096ff5befe191329e0 (patch)
tree6f1f726b515e3268522a22a47d8ce956b7f704e2
parent0ecededefa242f36c09a8d90ea34e51e8834ed0d (diff)
exit immediately after halt or halt_error is called
Instead of continuing to the next input, and only exiting if there are no more inputs. Closes #2533
-rw-r--r--src/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index c5a47c8f..355e4bfc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -692,6 +692,8 @@ int main(int argc, char* argv[]) {
ret = process(jq, value, jq_flags, dumpopts);
if (ret <= 0 && ret != JQ_OK_NO_OUTPUT)
last_result = (ret != JQ_OK_NULL_KIND);
+ if (jq_halted(jq))
+ break;
continue;
}