make command not block.
This commit is contained in:
parent
83b0ff4369
commit
e833d990db
@ -349,7 +349,13 @@ void Application::requetExit() {
|
|||||||
nng_log_set_logger(nng_stderr_logger);
|
nng_log_set_logger(nng_stderr_logger);
|
||||||
LOG(info) << "send exit request to program.";
|
LOG(info) << "send exit request to program.";
|
||||||
Nng::Socket request(Nng::Request);
|
Nng::Socket request(Nng::Request);
|
||||||
request.dial(IpcUrl);
|
request.setOption(Nng::RecvTimeout, std::chrono::milliseconds(2000));
|
||||||
|
std::error_code error;
|
||||||
|
request.dial(IpcUrl, error);
|
||||||
|
if (error) {
|
||||||
|
LOG(error) << error.message();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boost::json::object object;
|
boost::json::object object;
|
||||||
object["command"] = "exit";
|
object["command"] = "exit";
|
||||||
|
@ -32,10 +32,6 @@ int main(int argc, char const *argv[]) {
|
|||||||
try {
|
try {
|
||||||
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, description), values);
|
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, description), values);
|
||||||
boost::program_options::notify(values);
|
boost::program_options::notify(values);
|
||||||
} catch (const boost::program_options::invalid_command_line_syntax &e) {
|
|
||||||
LOG(fatal) << e.what();
|
|
||||||
std::exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values.count("help")) {
|
if (values.count("help")) {
|
||||||
std::cout << description << std::endl;
|
std::cout << description << std::endl;
|
||||||
@ -115,4 +111,10 @@ int main(int argc, char const *argv[]) {
|
|||||||
boost::system::error_code perror;
|
boost::system::error_code perror;
|
||||||
proxy->run(perror);
|
proxy->run(perror);
|
||||||
return application->exec();
|
return application->exec();
|
||||||
|
} catch (const boost::program_options::invalid_command_line_syntax &e) {
|
||||||
|
LOG(fatal) << e.what();
|
||||||
|
std::exit(-1);
|
||||||
|
} catch (const std::exception &e) {
|
||||||
|
LOG(error) << e.what();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user