]> ruin.nu Git - popboot.git/blobdiff - action.cpp
major bugfix
[popboot.git] / action.cpp
index 52c1686f21f3bc09ac096c8cae91327013fc5d7c..51e11e051e2d71de8b8419f20ca3a36bf5298ab1 100644 (file)
@@ -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{