diff options
Diffstat (limited to 'cpp/src/slice2html/Gen.cpp')
-rw-r--r-- | cpp/src/slice2html/Gen.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/cpp/src/slice2html/Gen.cpp b/cpp/src/slice2html/Gen.cpp index 91a114601de..3be0eecb3e2 100644 --- a/cpp/src/slice2html/Gen.cpp +++ b/cpp/src/slice2html/Gen.cpp @@ -30,6 +30,20 @@ using namespace Slice; using namespace IceUtil; using namespace IceUtilInternal; +// +// Callback for Crtl-C signal handling +// +static GeneratorBase* _genBase = 0; + +static void closeCallback() +{ + if(_genBase != 0) + { + _genBase->closeStream(); + } +} + + namespace Slice { @@ -38,6 +52,8 @@ generate(const UnitPtr& unit, const string& dir, const string& header, const str const string& indexHeader, const string& indexFooter, const string& imageDir, const string& logoURL, const string& searchAction, unsigned indexCount, unsigned warnSummary) { + SignalHandler::setCloseCallback(closeCallback); + unit->mergeModules(); // @@ -87,6 +103,8 @@ generate(const UnitPtr& unit, const string& dir, const string& header, const str GeneratorBase::setSymbols(tocv.symbols()); PageVisitor v(files); unit->visit(&v, false); + + SignalHandler::setCloseCallback(0); } } @@ -196,10 +214,12 @@ Slice::GeneratorBase::setSymbols(const ContainedList& symbols) Slice::GeneratorBase::GeneratorBase(XMLOutput& o, const Files& files) : _out(o), _files(files) { + _genBase = this; } Slice::GeneratorBase::~GeneratorBase() { + _genBase = 0; } // @@ -1242,7 +1262,7 @@ Slice::GeneratorBase::getLogoURL() void Slice::GeneratorBase::openStream(const string& path) { - SignalHandler::addFile(path); + SignalHandler::addFileForCleanup(path); _out.open(path.c_str()); if(!_out.isOpen()) |