X-Git-Url: https://ruin.nu/git/?p=popboot.git;a=blobdiff_plain;f=action.cpp;fp=action.cpp;h=52c1686f21f3bc09ac096c8cae91327013fc5d7c;hp=6e4b60785917cf7627c7ef1969b9621481c40022;hb=3f82360c5e0c61eccacdbaf3bd077852b9326f34;hpb=a425dcba102ae92c0b132afa598318447d7f78c4 diff --git a/action.cpp b/action.cpp index 6e4b607..52c1686 100644 --- a/action.cpp +++ b/action.cpp @@ -1,5 +1,7 @@ #include "action.h" #include +#include +#include #include using namespace std; using namespace __gnu_cxx; @@ -33,7 +35,21 @@ const Preconditions& Action::preconditions() const{ int Action::execute() const{ cout << "Executing: " << _name << endl; - return system(_executable.c_str()); + //return system(_executable.c_str()); + pid_t proc = fork(); + if (proc == -1) return proc; + + if (proc == 0) { + //execl("/bin/sh", "-c", _executable.c_str(), (char*) NULL); + int val = system(_executable.c_str()); + exit(val); + } + int retval; + + waitpid(proc,&retval,0); + + cout << "Done executing: " << _name << endl; + return retval; } const string& Action::name() const{