From: David Bremner Date: Fri, 15 Sep 2023 12:50:02 +0000 (-0300) Subject: CLI: exit with error when load_config returns an error. X-Git-Tag: 0.38.1_pre0~6 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=dbb5ff338511bfa6718ed144b95a689809d4bea1 CLI: exit with error when load_config returns an error. For now print a generic error message and exit with error on any non-success code. Previously the code exited, but with exit code zero, leading users / scripts to think the command had succeeded. --- diff --git a/notmuch.c b/notmuch.c index 37286b8f..69a18131 100644 --- a/notmuch.c +++ b/notmuch.c @@ -584,6 +584,8 @@ main (int argc, char *argv[]) case NOTMUCH_STATUS_SUCCESS: break; default: + fputs ("Error: unable to load config file.\n", stderr); + ret = 1; goto DONE; } diff --git a/test/T030-config.sh b/test/T030-config.sh index c416e781..2d3017da 100755 --- a/test/T030-config.sh +++ b/test/T030-config.sh @@ -196,7 +196,6 @@ output=$(notmuch config get built_with.nonexistent) test_expect_equal "$output" "false" test_begin_subtest "Bad utf8 reported as error" -test_subtest_known_broken cp initial-config bad-config printf '[query]\nq3=from:\xff\n' >>bad-config test_expect_code 1 "notmuch --config=./bad-config config list"