From 03f7ee9b1218ae8b87966dbbd91c73bb516e50d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 9 Jun 2016 11:12:07 +0200 Subject: [PATCH] posix shell: do not complaining about non-existing command muorb on SITL exit Namely the following output after Ctrl-C: Invalid command: muorb type 'help' for a list of commands --- src/platforms/posix/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platforms/posix/main.cpp b/src/platforms/posix/main.cpp index fb5b7fe751..6d9d33e7e2 100644 --- a/src/platforms/posix/main.cpp +++ b/src/platforms/posix/main.cpp @@ -92,7 +92,7 @@ static void print_prompt() cout.flush(); } -static void run_cmd(const vector &appargs, bool exit_on_fail) +static void run_cmd(const vector &appargs, bool exit_on_fail, bool silently_fail = false) { // command is appargs[0] string command = appargs[0]; @@ -125,7 +125,7 @@ static void run_cmd(const vector &appargs, bool exit_on_fail) } else if (command.length() == 0 || command[0] == '#') { // Do nothing - } else { + } else if (!silently_fail) { cout << "Invalid command: " << command << "\ntype 'help' for a list of commands" << endl; } @@ -392,7 +392,7 @@ int main(int argc, char **argv) //if (px4_task_is_running("muorb")) { // sending muorb stop is needed if it is running to exit cleanly vector muorb_stop_cmd = { "muorb", "stop" }; - run_cmd(muorb_stop_cmd, !daemon_mode); + run_cmd(muorb_stop_cmd, !daemon_mode, true); } vector shutdown_cmd = { "shutdown" };