#include <string>
#include <utility>
#include <vector>
+#include <functional>
+#include <unistd.h>
namespace common_installer {
return RunWithArgs(argv);
}
+ template <typename... Args>
+ bool RunFunc(std::function<int(Args...)> func, Args&&... args) {
+ if (started_) {
+ return false;
+ }
+ pid_ = fork();
+ if (pid_ == 0) {
+ exit(func(std::forward<Args>(args)...));
+ return false;
+ } else if (pid_ == -1) {
+ return false;
+ } else {
+ started_ = true;
+ return true;
+ }
+ }
+
bool RunWithArgs(
const std::vector<std::string>& args = std::vector<std::string>());
int Wait();