changed how gnunet-testing-run-service communicates over stdin/stdout
authorFlorian Dold <florian.dold@gmail.com>
Wed, 13 Jun 2012 12:41:21 +0000 (12:41 +0000)
committerFlorian Dold <florian.dold@gmail.com>
Wed, 13 Jun 2012 12:41:21 +0000 (12:41 +0000)
src/testing/gnunet-testing-run-service.c

index fe0028971d4a2dad09fd54417ec0b3305de703de..c9e11526073a7d2046b907aeeaf058818700f87d 100644 (file)
@@ -83,14 +83,14 @@ stdin_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if (GNUNET_SCHEDULER_REASON_READ_READY & tc->reason)
   {
     c = getchar ();
-    if (EOF == c)
+    if (EOF == c || 'q' == c)
     {
       tid = GNUNET_SCHEDULER_NO_TASK;
       cleanup ();
     }
     else
     {
-      if (c == 'r')
+      if ('r' == c)
       {
         GNUNET_TESTING_peer_stop(my_peer); 
         GNUNET_TESTING_peer_start(my_peer); 
@@ -128,7 +128,7 @@ testing_main (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
     return;
   }
 
-  printf("%s\n", tmpfilename);
+  printf("started\n%s\n", tmpfilename);
   fflush(stdout);
 
   GNUNET_break(NULL != GNUNET_SIGNAL_handler_install(SIGTERM, &cleanup));
@@ -179,8 +179,14 @@ main (int argc, char *const *argv)
 
   ret =  GNUNET_TESTING_service_run_restartable ("gnunet_service_test", argv[1],
                                                  NULL, &testing_main, NULL);
-
-  printf ("bye\n");
-
+  if (ret)
+  {
+    printf ("error\n");
+  }
+  else 
+  {
+    printf ("bye\n");
+  }
   return ret;
 }
+