]> git.sur5r.net Git - openocd/commitdiff
server: shutdown command should lead to exit without evaluating the rest
authorPaul Fertser <fercerpav@gmail.com>
Tue, 27 Jan 2015 18:10:18 +0000 (21:10 +0300)
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>
Wed, 11 Feb 2015 22:18:33 +0000 (22:18 +0000)
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 <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2511
Tested-by: jenkins
Reviewed-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/server/server.c

index 7fbceb19a71fb3d32e899b506dfeb7ef3a9d2411..9f9f2f1aa61333223963a1a46164d50cd9fd7b3b 100644 (file)
@@ -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)