fix: 尝试修复调用命令时抛出异常的问题

fix https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/1871
This commit is contained in:
MistEO
2022-09-21 23:26:49 +08:00
parent 6fba1bf790
commit 973bea20c4
2 changed files with 11 additions and 5 deletions

View File

@@ -51,7 +51,7 @@ asst::Controller::Controller(AsstCallback callback, void* callback_arg)
fcntl(m_pipe_out[PIPE_READ], F_SETFL, O_NONBLOCK);
if (pipe_in_ret < 0 || pipe_out_ret < 0) {
throw "controller pipe created failed";
Log.error(__FUNCTION__, "controller pipe created failed", pipe_in_ret, pipe_out_ret);
}
m_support_socket = false;
#endif
@@ -293,7 +293,9 @@ std::optional<std::string> asst::Controller::call_command(const std::string& cmd
else {
// something bad happened
err = GetLastError();
throw std::system_error(std::error_code(err, std::system_category()));
// throw std::system_error(std::error_code(err, std::system_category()));
Log.error(__FUNCTION__, "A fatal error occurred", err);
break;
}
if (signaled_object == process_info.hProcess) {