mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
fix.修复Linux下的编译错误
This commit is contained in:
@@ -26,7 +26,7 @@ namespace asst
|
||||
void set_task_chain(std::string name) noexcept { m_task_chain = std::move(name); }
|
||||
const std::string& get_task_chain() const noexcept { return m_task_chain; }
|
||||
|
||||
constexpr static int RetryTimesDefault = 20;
|
||||
constexpr static int RetryTimesDefault = 50;
|
||||
protected:
|
||||
virtual bool _run() = 0;
|
||||
virtual bool on_run_fails() { return true; }
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace asst
|
||||
|
||||
[[deprecated]] bool set_param(const std::string& type, const std::string& param, const std::string& value);
|
||||
|
||||
static constexpr int ProcessTaskRetryTimesDefault = 50;
|
||||
static constexpr int ProcessTaskRetryTimesDefault = AbstractTask::RetryTimesDefault;
|
||||
static constexpr int OpenRecruitTaskRetryTimesDefault = 20;
|
||||
static constexpr int AutoRecruitTaskRetryTimesDefault = 10;
|
||||
|
||||
|
||||
@@ -61,6 +61,9 @@ asst::Controller::Controller()
|
||||
|
||||
#endif
|
||||
m_pipe_buffer = std::make_unique<uchar[]>(PipeBuffSize);
|
||||
if (!m_pipe_buffer) {
|
||||
throw "controller pipe buffer allocated failed";
|
||||
}
|
||||
|
||||
auto bind_pipe_working_proc = std::bind(&Controller::pipe_working_proc, this);
|
||||
m_cmd_thread = std::thread(bind_pipe_working_proc);
|
||||
@@ -447,11 +450,11 @@ std::pair<bool, std::vector<unsigned char>> asst::Controller::call_command(const
|
||||
// parent process
|
||||
// LogTraceScope("Parent process: " + cmd);
|
||||
do {
|
||||
ssize_t read_num = read(m_pipe_out[PIPE_READ], m_pipe_buffer.get(), BuffSize);
|
||||
ssize_t read_num = read(m_pipe_out[PIPE_READ], m_pipe_buffer.get(), PipeBuffSize);
|
||||
|
||||
while (read_num > 0) {
|
||||
pipe_data.insert(pipe_data.end(), m_pipe_buffer.get(), m_pipe_buffer.get() + read_num);
|
||||
read_num = read(m_pipe_out[PIPE_READ], m_pipe_buffer.get(), BuffSize);
|
||||
read_num = read(m_pipe_out[PIPE_READ], m_pipe_buffer.get(), PipeBuffSize);
|
||||
};
|
||||
} while (::waitpid(m_child, nullptr, WNOHANG) == 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user