2021-01-03 14:55:15 +01:00
|
|
|
#include "process.h"
|
|
|
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
|
|
|
|
|
|
bool
|
2021-01-22 19:20:30 +01:00
|
|
|
process_check_success(process_t proc, const char *name, bool close) {
|
2021-01-03 14:55:15 +01:00
|
|
|
if (proc == PROCESS_NONE) {
|
|
|
|
|
LOGE("Could not execute \"%s\"", name);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-01-22 19:20:30 +01:00
|
|
|
exit_code_t exit_code = process_wait(proc, close);
|
2021-01-22 18:29:21 +01:00
|
|
|
if (exit_code) {
|
2021-01-03 14:55:15 +01:00
|
|
|
if (exit_code != NO_EXIT_CODE) {
|
|
|
|
|
LOGE("\"%s\" returned with value %" PRIexitcode, name, exit_code);
|
|
|
|
|
} else {
|
|
|
|
|
LOGE("\"%s\" exited unexpectedly", name);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|