From 1da884db15b5fc84159b2dd6c1b12f0f02eb396c Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sat, 9 Apr 2022 13:54:21 +0200 Subject: [PATCH] Handle processing errors appropriately Alter the return status accordingly, and print the error counts on exit --- src/gfx/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gfx/main.cpp b/src/gfx/main.cpp index 6fc9531b..49156298 100644 --- a/src/gfx/main.cpp +++ b/src/gfx/main.cpp @@ -706,7 +706,8 @@ int main(int argc, char *argv[]) { // Do not do anything if option parsing went wrong if (nbErrors) { - return 0; + fprintf(stderr, "Conversion aborted after %ju error%s\n", nbErrors, nbErrors == 1 ? "" : "s"); + return 1; } if (options.reverse()) { @@ -715,6 +716,10 @@ int main(int argc, char *argv[]) { process(); } + if (nbErrors) { + fprintf(stderr, "Conversion aborted after %ju error%s\n", nbErrors, nbErrors == 1 ? "" : "s"); + return 1; + } return 0; }