pid_t proc = fork();
if (proc == -1) return proc;
+ int retval;
if (proc == 0) {
//execl("/bin/sh", "-c", _executable.c_str(), (char*) NULL);
- int val = system(_executable.c_str());
- exit(val);
+ retval = system(_executable.c_str());
+ _exit(WEXITSTATUS(retval));
}
- int retval;
-
waitpid(proc,&retval,0);
-
- cout << "Done executing: " << _name << endl;
- return retval;
+ cout << "Done executing: " << _name << ", returnvalue: " << WEXITSTATUS(retval) << endl;
+ return WEXITSTATUS(retval);
}
const string& Action::name() const{