summaryrefslogtreecommitdiff
path: root/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'main.cc')
-rw-r--r--main.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/main.cc b/main.cc
index 3d069234..7a0b8141 100644
--- a/main.cc
+++ b/main.cc
@@ -22,7 +22,6 @@ using namespace ledger;
#include <iostream>
#include <fstream>
#include <sstream>
-#include <list>
#include <memory>
#include <algorithm>
#include <iterator>
@@ -643,14 +642,23 @@ int parse_and_report(int argc, char * argv[], char * envp[])
int main(int argc, char * argv[], char * envp[])
{
+ int status = 0;
+
initialize();
- int status = parse_and_report(argc, argv, envp);
+ try {
+ status = parse_and_report(argc, argv, envp);
+ }
+ catch (int& val) {
+#if DEBUG_LEVEL >= BETA
+ shutdown();
+#endif
+ return val;
+ }
#if DEBUG_LEVEL >= BETA
shutdown();
#endif
-
return status;
}