From 5f9562ce34700b8d8c4de726d82db3375ce542fa Mon Sep 17 00:00:00 2001 From: Simon Guest Date: Mon, 28 Oct 2024 17:38:40 +1300 Subject: [PATCH] On error exit code is 1 as it always should have been Fixes #9 --- README.md | 2 +- bash-env-json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cd2905f..37efa8b 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ $ ./bash-env-json --shellfns f2,f3 ./tests/shell-functions.env | jq ## Exit Status -Detecting and returning errors in JSON is normal behaviour for `bash-env-json` which is why the exit code in such cases is `0` and not `1` as might otherwise be expected. +Any error is returned in the JSON `error` field, and `bash-env-json` returns an exit code of `1` in the usual way. ## Tests diff --git a/bash-env-json b/bash-env-json index 641da58..ffcc604 100755 --- a/bash-env-json +++ b/bash-env-json @@ -83,7 +83,7 @@ function emit_error() { function emit_error_exit() { emit_error "$@" | jq - exit 0 + exit 1 } function emit_help_exit() {