Change-Id: I7d02a2c2920cd00c1608b84bbbdab8f1fa68fd3e
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
}
}
-bool Subprocess::Wait() {
+int Subprocess::Wait() {
if (!started_) {
LOG(WARNING) << "Process is not started. Cannot wait";
- return false;
+ return -1;
}
int status;
waitpid(pid_, &status, 0);
- if (WIFEXITED(status) == 0 || WEXITSTATUS(status) != 0)
- return false;
-
- return true;
+ return status;
}
void Subprocess::Kill() {
bool RunWithArgs(
const std::vector<std::string>& args = std::vector<std::string>());
- bool Wait();
+ int Wait();
void set_uid(int uid) {
uid_ = uid;
params.emplace_back("--preload");
}
- backend.RunWithArgs(params);
- if (!backend.Wait()) {
- std::cerr << "Failed to run backend" << std::endl;
+ if (!backend.RunWithArgs(params)) {
+ std::cerr << "Failed to start backend" << std::endl;
+ return false;
+ }
+ int status = backend.Wait();
+ if (WIFEXITED(status) == 0 || WEXITSTATUS(status) != 0) {
+ std::cerr << "Backend operation failed" << std::endl;
return false;
}