summaryrefslogtreecommitdiff
path: root/src/cli_shell_api.cpp
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2020-02-10 22:59:27 +0100
committerDaniil Baturin <daniil@baturin.org>2020-02-10 22:59:27 +0100
commit7f6eb1ed2c2a9dc76227ac355446b6d4b6c27733 (patch)
tree7da0ad990903eacd43c398577058a93a3f170460 /src/cli_shell_api.cpp
parent699963ac8cce88fe15751e3b426f4381bade02f2 (diff)
downloadvyatta-cfg-7f6eb1ed2c2a9dc76227ac355446b6d4b6c27733.tar.gz
vyatta-cfg-7f6eb1ed2c2a9dc76227ac355446b6d4b6c27733.zip
T2026: make cli-shell-api showConfig fail on errors.
Diffstat (limited to 'src/cli_shell_api.cpp')
-rw-r--r--src/cli_shell_api.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cli_shell_api.cpp b/src/cli_shell_api.cpp
index 0439ccf..5766857 100644
--- a/src/cli_shell_api.cpp
+++ b/src/cli_shell_api.cpp
@@ -31,6 +31,8 @@
using namespace cstore;
+int exit_code = 0;
+
/* This program provides an API for shell scripts (e.g., snippets in
* templates, standalone scripts, etc.) to access the CLI cstore library.
* It is installed in "/opt/vyatta/sbin", but a symlink "/bin/cli-shell-api"
@@ -537,9 +539,10 @@ showConfig(Cstore& cstore, const Cpath& args)
// default
}
- cnode::showConfig(cfg1, cfg2, args, op_show_show_defaults,
+ int res = cnode::showConfig(cfg1, cfg2, args, op_show_show_defaults,
op_show_hide_secrets, op_show_context_diff,
op_show_commands, op_show_ignore_edit);
+ exit_code = res;
}
static void
@@ -765,7 +768,7 @@ main(int argc, char **argv)
Cstore *cstore = Cstore::createCstore(OP_use_edit);
OP_func(*cstore, args);
delete cstore;
- exit(0);
+ exit(exit_code);
}