Index: /trunk/FACT++/src/Main.h
===================================================================
--- /trunk/FACT++/src/Main.h	(revision 13795)
+++ /trunk/FACT++/src/Main.h	(revision 13796)
@@ -71,9 +71,9 @@
     }
 
-    void Thread(MainImp *io_service, bool dummy)
+    void Thread(MainImp *io_service, bool dummy, int &rc)
     {
         // This is necessary so that the StateMachien Thread can signal the
         // Readline to exit
-        io_service->Run(dummy);
+        rc = io_service->Run(dummy);
         Readline::Stop();
     }
@@ -189,5 +189,6 @@
 
         //    boost::thread t(boost::bind(&AutoScheduler<S>::Run, &io_service));
-        thread t(bind(Main::Thread, &io_service, dummy));
+        int ret = 0;
+        thread t(bind(Main::Thread, &io_service, dummy, ref(ret)));
 
         const vector<string> v1 = conf.Vec<string>("cmd");
@@ -211,5 +212,5 @@
         t.join();
 
-        return 0;
+        return ret;
     }
 }
