diff --git a/lib/command.h b/lib/command.h index c76fc1e8e..8a7c9a204 100644 --- a/lib/command.h +++ b/lib/command.h @@ -229,6 +229,7 @@ struct cmd_node { #define CMD_WARNING_CONFIG_FAILED 13 #define CMD_NOT_MY_INSTANCE 14 #define CMD_NO_LEVEL_UP 15 +#define CMD_ERR_NO_DAEMON 16 /* Argc max counts. */ #define CMD_ARGC_MAX 256 diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index b74360c75..beb7045a7 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -602,7 +602,8 @@ static int vtysh_execute_func(const char *line, int pager) fprintf(stderr, "%s is not running\n", vtysh_client[i].name); - continue; + cmd_stat = CMD_ERR_NO_DAEMON; + break; } } cmd_stat = vtysh_client_execute( @@ -611,7 +612,7 @@ static int vtysh_execute_func(const char *line, int pager) break; } } - if (cmd_stat != CMD_SUCCESS) + if (cmd_stat != CMD_SUCCESS && cmd_stat != CMD_ERR_NO_DAEMON) break; if (cmd->func)