feat(action): 重构 action 接口为函数指针表并实现 quit 和 raise_or_run
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "base/log.h"
|
||||
#include "config/runtime_config.h"
|
||||
#include "core/backend.h"
|
||||
@@ -32,7 +35,11 @@ static void bootstrap(runtime_t *runtime) {
|
||||
}
|
||||
};
|
||||
|
||||
int main(void) {
|
||||
char **cmd_argv = nullptr;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
cmd_argv = argv;
|
||||
|
||||
runtime_t runtime = {0};
|
||||
|
||||
bootstrap(&runtime);
|
||||
@@ -40,5 +47,10 @@ int main(void) {
|
||||
runtime_run(&runtime);
|
||||
runtime_shutdown(&runtime);
|
||||
|
||||
if (runtime.will_restart) {
|
||||
execvp(cmd_argv[0], cmd_argv);
|
||||
fatal("execv() failed: %s", strerror(errno));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user