[rtems-schedsim commit] schedsim.cc: Exit on bad command result

Joel Sherrill joel at rtems.org
Fri May 23 21:40:59 UTC 2014


Module:    rtems-schedsim
Branch:    master
Commit:    44cf36b76f2d159158a0f6a0d03fa34fff45a2c5
Changeset: http://git.rtems.org/rtems-schedsim/commit/?id=44cf36b76f2d159158a0f6a0d03fa34fff45a2c5

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Fri May 23 16:26:52 2014 -0500

schedsim.cc: Exit on bad command result

---

 schedsim/shell/schedsim_smpsimple/schedsim.cc |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/schedsim/shell/schedsim_smpsimple/schedsim.cc b/schedsim/shell/schedsim_smpsimple/schedsim.cc
index f0960a8..5136ac9 100644
--- a/schedsim/shell/schedsim_smpsimple/schedsim.cc
+++ b/schedsim/shell/schedsim_smpsimple/schedsim.cc
@@ -48,6 +48,7 @@ void ProcessScript(
 )
 {
   char               buffer[512];
+  int                sc;
   char              *cStatus;
   char              *c;
   size_t             length;
@@ -79,7 +80,7 @@ void ProcessScript(
 
 
     if (!strcmp(c,"bye") || !strcmp(c,"exit")) {
-      return;
+      exit( 0 );
     } 
 
     if (rtems_shell_make_args(c, &argc, argv, RTEMS_SHELL_MAXIMUM_ARGUMENTS)) {
@@ -93,10 +94,14 @@ void ProcessScript(
     shell_cmd = rtems_shell_lookup_cmd(argv[0]);
     if ( !shell_cmd ) {
       fprintf(stderr, "%s is unknown command\n", c );
-      continue;
+      exit( 1 );
     }
 
-    shell_cmd->command(argc, argv);
+    sc = shell_cmd->command(argc, argv);
+    if ( sc != 0 ) {
+      fprintf( stderr, "ERROR: Command %s returned %d\n", argv[0], sc );
+      exit( sc );
+    }
   }
 }
 




More information about the vc mailing list