From: Paul Fertser Date: Tue, 27 Jan 2015 18:10:18 +0000 (+0300) Subject: server: shutdown command should lead to exit without evaluating the rest X-Git-Tag: v0.9.0-rc1~130 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=a35712a85c420e24a9c7e9a5eea4fc6d3aff6342;hp=25e7a69e266b7c848af3c88f5743c88120d28d0f server: shutdown command should lead to exit without evaluating the rest Currently openocd -c "echo a1; shutdown; echo a2" outputs both "a1" and "a2" and only then shuts down. This patch fixes it by making shutdown command throw an exception, so unless it's caught the shutdown will behave as expected. Change-Id: I764268b3a9046ff3e9717d04095ea0673f1d755a Signed-off-by: Paul Fertser Reviewed-on: http://openocd.zylin.com/2511 Tested-by: jenkins Reviewed-by: Uwe Bonnes Reviewed-by: Spencer Oliver --- diff --git a/src/server/server.c b/src/server/server.c index 7fbceb19a7..9f9f2f1aa6 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -589,7 +589,7 @@ COMMAND_HANDLER(handle_shutdown_command) shutdown_openocd = 1; - return ERROR_OK; + return ERROR_COMMAND_CLOSE_CONNECTION; } COMMAND_HANDLER(handle_poll_period_command)