• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision20745f4b8ed9fb6f20df83143a686eecb0112936 (tree)
Zeit2013-01-25 16:59:16
AutorKatsuhiko Nishimra <ktns.87@gmai...>
CommiterKatsuhiko Nishimra

Log Message

tmp Exit when caught signal

Ändern Zusammenfassung

Diff

--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -18,6 +18,7 @@
1818 //************************************************************************//
1919 #include<stdio.h>
2020 #include<stdlib.h>
21+#include<signal.h>
2122 #include<iostream>
2223 #include<vector>
2324 #include<stdexcept>
@@ -30,7 +31,19 @@
3031 #include"base/Molecule.h"
3132 #include"base/MolDS.h"
3233 using namespace std;
34+
35+void my_signal_handler(int signal){
36+ cerr << "Caught signal " << signal << "!" << endl << flush;
37+ cout << flush;
38+ exit(1);
39+}
40+
3341 int main(int argc, char *argv[]){
42+ signal(SIGINT, my_signal_handler);
43+ signal(SIGTERM, my_signal_handler);
44+ signal(SIGHUP, my_signal_handler);
45+ signal(SIGILL, my_signal_handler);
46+ signal(SIGABRT, my_signal_handler);
3447 try{
3548 boost::shared_ptr<MolDS_base::MolDS> molds(new MolDS_base::MolDS());
3649 molds->Run(argc, argv);