After `<daemon_name> is not running` message vtysh does not return
error. For example if you disable ospf in `/etc/frr/daemons` and run
`vtysh -c configure -c "router ospf"` it prints the message to stderr,
but returns 0.
This commit will make vtysh return error when not in interractive mode.
But if you run commands from vtysh, you will still be able to enter
views and exit them if daemon is not running.
Signed-off-by: Yaroslav Fedoriachenko <yar.fed99@gmail.com>
#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
fprintf(stderr,
"%s is not running\n",
vtysh_client[i].name);
- continue;
+ cmd_stat = CMD_ERR_NO_DAEMON;
+ break;
}
}
cmd_stat = vtysh_client_execute(
break;
}
}
- if (cmd_stat != CMD_SUCCESS)
+ if (cmd_stat != CMD_SUCCESS && cmd_stat != CMD_ERR_NO_DAEMON)
break;
if (cmd->func)