Split command into process and adb

The process API provides the system-specific implementation, the adb API
uses it to expose adb commands.
This commit is contained in:
Romain Vimont
2021-01-03 14:55:15 +01:00
parent aa8b571389
commit 4bd9da4c93
12 changed files with 97 additions and 80 deletions

21
app/src/util/process.c Normal file
View File

@@ -0,0 +1,21 @@
#include "process.h"
#include "log.h"
bool
process_check_success(process_t proc, const char *name) {
if (proc == PROCESS_NONE) {
LOGE("Could not execute \"%s\"", name);
return false;
}
exit_code_t exit_code;
if (!process_simple_wait(proc, &exit_code)) {
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;
}