libt2n: (tomj) added exception handling to every child after fork(). This is needed...
[libt2n] / test / cmdgroup.cpp
index 314e28d..eee54bf 100644 (file)
@@ -193,12 +193,18 @@ class test_cmdgroup : public TestFixture
             case 0:
             // child
             {
-                socket_server ss("./socket");
-                group_command_server<cmd_group_a> cs(ss);
+                try
+                {
+                    socket_server ss("./socket");
+                    group_command_server<cmd_group_a> cs(ss);
 
-                // max 10 sec
-                for (int i=0; i < 10; i++)
-                    cs.handle(1000000);
+                    // max 10 sec
+                    for (int i=0; i < 10; i++)
+                        cs.handle(1000000);
+                } catch(...)
+                {
+                    std::cerr << "exception in child. ignoring\n";
+                }
 
                 // don't call atexit and stuff
                 _exit(0);
@@ -234,12 +240,18 @@ class test_cmdgroup : public TestFixture
             case 0:
             // child
             {
-                socket_server ss("./socket");
-                group_command_server<cmd_group_b> cs(ss);
+                try
+                {
+                    socket_server ss("./socket");
+                    group_command_server<cmd_group_b> cs(ss);
 
-                // max 10 sec
-                for (int i=0; i < 10; i++)
-                    cs.handle(1000000);
+                    // max 10 sec
+                    for (int i=0; i < 10; i++)
+                        cs.handle(1000000);
+                } catch(...)
+                {
+                    std::cerr << "exception in child. ignoring\n";
+                }
 
                 // don't call atexit and stuff
                 _exit(0);