Don't show logcat exit code if there's any request

This commit is contained in:
blankie 2023-02-03 12:01:19 +07:00
parent 04c46e220f
commit 1c44b770a8
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 4 additions and 4 deletions

View File

@ -232,7 +232,7 @@ void LogcatThread::_run_epoll_round() {
}
}
void LogcatThread::_try_reap(bool stop_requested) {
void LogcatThread::_try_reap(bool has_request) {
int wstatus;
int res = waitpid(this->_logcat_pid, &wstatus, WNOHANG);
if (res == -1) {
@ -256,13 +256,13 @@ void LogcatThread::_try_reap(bool stop_requested) {
this->logcat_process_running.clear();
if (WIFEXITED(wstatus)) {
if (WEXITSTATUS(wstatus) && !stop_requested) {
if (WEXITSTATUS(wstatus) && !has_request) {
LogEntry log_entry = {time(nullptr), std::string("Logcat exited with ") + std::to_string(WEXITSTATUS(wstatus))};
print_log(log_entry);
this->_put_if_not_stopped(std::move(log_entry));
}
} else if (WIFSIGNALED(wstatus)) {
if (!stop_requested) {
if (!has_request) {
LogEntry log_entry = {time(nullptr), std::string("Logcat exited with -") + std::to_string(WTERMSIG(wstatus))};
print_log(log_entry);
this->_put_if_not_stopped(std::move(log_entry));
@ -359,7 +359,7 @@ bool LogcatThread::_run_process_round(LogcatProcessRequest request) {
};
if (this->_logcat_pid != -1) {
this->_try_reap(request == LogcatProcessRequest::Stop);
this->_try_reap(request != LogcatProcessRequest::None);
}
return task_done;