add error_exit_val argument to exit nonzero if there are processing errors
authorNoel Burton-Krahn <noel@burton-krahn.com>
Wed, 14 Dec 2016 00:55:30 +0000 (16:55 -0800)
committerNoel Burton-Krahn <noel@burton-krahn.com>
Wed, 14 Dec 2016 00:55:30 +0000 (16:55 -0800)
src/cmd_parser.c
src/cmd_parser.h
src/createrepo_c.c

index 866b7f650309a2fd1e5cc53326bc3cd1dd56e5b1..7367bc7ac2ae7656c31273e4b14b484c323345d1 100644 (file)
@@ -186,6 +186,8 @@ static GOptionEntry cmd_entries[] =
       "Append this prefix before location_href in output repodata", "PREFIX" },
     { "repomd-checksum", 0, 0, G_OPTION_ARG_STRING, &(_cmd_options.repomd_checksum),
       "Checksum type to be used in repomd.xml", "CHECKSUM_TYPE"},
+    { "error-exit-val", 0, 0, G_OPTION_ARG_NONE, &(_cmd_options.error_exit_val),
+      "Exit with retval 2 if there were any errors during processing", NULL },
     { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL },
 };
 
index 40051e73e947a6cbf0d47155e7105c910958e885..64c7c0d28aa9bc5c0edb8ef1768ca3fb2e412972 100644 (file)
@@ -105,6 +105,7 @@ struct CmdOptions {
     gchar *location_prefix;     /*!< Append this prefix into location_href
                                      during repodata generation. */
     gchar *repomd_checksum;     /*!< Checksum type for entries in repomd.xml */
+    gboolean error_exit_val;        /*!< exit 2 on processing errors */
 
     /* Items filled by check_arguments() */
 
index 965cfc223814b1af87c28dac1b28d78f2b7e6ff3..e16ae349a287485ab3577e68b18fac19a28637af 100644 (file)
@@ -864,8 +864,8 @@ main(int argc, char **argv)
     g_thread_pool_free(pool, FALSE, TRUE);
 
     // if there were any errors, exit nonzero
-    if( user_data.had_errors ) {
-       exit_val = EXIT_FAILURE;
+    if( cmd_options->error_exit_val && user_data.had_errors ) {
+       exit_val = 2;
     }
 
     g_message("Pool finished%s", (user_data.had_errors ? " with errors" : ""));