Fix pkg_initdb tool to check backend execution result
[platform/core/appfw/app-installers.git] / src / common / utils / subprocess.cc
index 3c0b7a5..d5ca6d2 100644 (file)
@@ -53,14 +53,17 @@ bool Subprocess::RunWithArgs(const std::vector<std::string>& args) {
   }
 }
 
-int Subprocess::Wait() {
+bool Subprocess::Wait() {
   if (!started_) {
     LOG(WARNING) << "Process is not started. Cannot wait";
-    return -1;
+    return false;
   }
   int status;
   waitpid(pid_, &status, 0);
-  return status;
+  if (WIFEXITED(status) == 0 || WEXITSTATUS(status) != 0)
+    return false;
+
+  return true;
 }
 
 void Subprocess::Kill() {