diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2008-01-18 10:27:58 -0330 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2008-01-18 10:27:58 -0330 |
commit | 40da4a3aecbc259c472d77f58d1d6466af42e5ef (patch) | |
tree | 3780215d0441c84682c9c281b3187b78973a6b9e /cpp/src/slice2rb/Main.cpp | |
parent | Added Windows signal handling (diff) | |
download | ice-40da4a3aecbc259c472d77f58d1d6466af42e5ef.tar.bz2 ice-40da4a3aecbc259c472d77f58d1d6466af42e5ef.tar.xz ice-40da4a3aecbc259c472d77f58d1d6466af42e5ef.zip |
Windows fixes for translator interrupt cleanup
Diffstat (limited to 'cpp/src/slice2rb/Main.cpp')
-rw-r--r-- | cpp/src/slice2rb/Main.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/cpp/src/slice2rb/Main.cpp b/cpp/src/slice2rb/Main.cpp index 8250a4a49ca..1bf68718f58 100644 --- a/cpp/src/slice2rb/Main.cpp +++ b/cpp/src/slice2rb/Main.cpp @@ -30,6 +30,16 @@ using namespace std; using namespace Slice; using namespace Slice::Ruby; +// +// Callback for Crtl-C signal handling +// +static IceUtilInternal::Output _out; + +static void closeCallback() +{ + _out.close(); +} + void usage(const char* n) { @@ -194,23 +204,26 @@ main(int argc, char* argv[]) } SignalHandler::addFile(file); - IceUtilInternal::Output out; - out.open(file.c_str()); - if(!out) + SignalHandler::setCallback(closeCallback); + + _out.open(file.c_str()); + if(!_out) { cerr << argv[0] << ": can't open `" << file << "' for writing" << endl; u->destroy(); return EXIT_FAILURE; } - printHeader(out); - out << "\n# Generated from file `" << base << ".ice'\n"; + printHeader(_out); + _out << "\n# Generated from file `" << base << ".ice'\n"; // // Generate the Ruby mapping. // - generate(u, all, checksum, includePaths, out); + generate(u, all, checksum, includePaths, _out); + _out.close(); + SignalHandler::setCallback(0); } u->destroy(); |