summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-05-23 16:26:52 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-05-23 16:46:49 -0500
commit44cf36b76f2d159158a0f6a0d03fa34fff45a2c5 (patch)
tree6ceb5c532ac5389142153f9393a2de44be49b293
parent718b2b6be887f56aad102be7378dff9947f84039 (diff)
downloadrtems-schedsim-44cf36b76f2d159158a0f6a0d03fa34fff45a2c5.tar.bz2
schedsim.cc: Exit on bad command result
-rw-r--r--schedsim/shell/schedsim_smpsimple/schedsim.cc11
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 );
+ }
}
}