diff options
Diffstat (limited to 'cpp/src/slice2docbook/Main.cpp')
-rw-r--r-- | cpp/src/slice2docbook/Main.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/cpp/src/slice2docbook/Main.cpp b/cpp/src/slice2docbook/Main.cpp index 9e7add9b40c..b5616743174 100644 --- a/cpp/src/slice2docbook/Main.cpp +++ b/cpp/src/slice2docbook/Main.cpp @@ -12,6 +12,7 @@ #include <IceUtil/CtrlCHandler.h> #include <IceUtil/StaticMutex.h> #include <Slice/Preprocessor.h> +#include <Slice/FileTracker.h> #include <Gen.h> using namespace std; @@ -91,7 +92,7 @@ main(int argc, char* argv[]) if(opts.isSet("version")) { - cout << ICE_STRING_VERSION << endl; + cerr << ICE_STRING_VERSION << endl; return EXIT_SUCCESS; } @@ -210,13 +211,20 @@ main(int argc, char* argv[]) if(status == EXIT_SUCCESS && !preprocess) { - Gen gen(argv[0], docbook, standAlone, chapter, noIndex, sortFields); - if(!gen) + try { + Gen gen(docbook, standAlone, chapter, noIndex, sortFields); + gen.generate(p); + } + catch(const Slice::FileException& ex) + { + // If a file could not be created, then + // cleanup any created files. + FileTracker::instance()->cleanup(); p->destroy(); + cerr << argv[0] << ": " << ex.reason() << endl; return EXIT_FAILURE; } - gen.generate(p); } p->destroy(); @@ -226,6 +234,7 @@ main(int argc, char* argv[]) if(_interrupted) { + FileTracker::instance()->cleanup(); return EXIT_FAILURE; } } |