X-Git-Url: https://ruin.nu/git/?p=popboot.git;a=blobdiff_plain;f=action.cpp;h=51e11e051e2d71de8b8419f20ca3a36bf5298ab1;hp=52c1686f21f3bc09ac096c8cae91327013fc5d7c;hb=318003cdb8615b39ef71761f55ac2159caabbf47;hpb=3f82360c5e0c61eccacdbaf3bd077852b9326f34 diff --git a/action.cpp b/action.cpp index 52c1686..51e11e0 100644 --- a/action.cpp +++ b/action.cpp @@ -39,17 +39,15 @@ int Action::execute() const{ 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; + waitpid(proc,&retval,NULL); + cout << "Done executing: " << _name << ", returnvalue: " << WEXITSTATUS(retval) << endl; + return WEXITSTATUS(retval); } const string& Action::name() const{