X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fexternalaction.cpp;h=88c7e544e7907671daa82a6d8381f29f46257356;hb=242c55b17e6608b29a77ca17a5b677e202a3ca90;hp=5d01f4f701071fd4b330b26618b897899a59110d;hpb=77461a8c0e2b5686b04cf15f3a9333b215813992;p=builder.git diff --git a/source/externalaction.cpp b/source/externalaction.cpp index 5d01f4f..88c7e54 100644 --- a/source/externalaction.cpp +++ b/source/externalaction.cpp @@ -1,7 +1,7 @@ /* $Id$ This file is part of builder -Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions +Copyright © 2006-2009 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ @@ -16,35 +16,6 @@ Distributed under the LGPL using namespace std; using namespace Msp; -int ExternalAction::check() -{ - if(builder.get_dry_run()) - { - signal_done.emit(); - return 0; - } - - if(!pid) - return exit_code; - - int status; - if(waitpid(pid, &status, WNOHANG)==pid) - { - signal_done.emit(); - if(WIFEXITED(status)) - exit_code=WEXITSTATUS(status); - else - exit_code=254; - pid=0; - return exit_code; - } - else - return -1; -} - -/** -Starts the external program. Fill in argv before calling this. -*/ void ExternalAction::launch() { if(builder.get_verbose()>=2) @@ -82,3 +53,29 @@ void ExternalAction::launch() pid=0; } } + +int ExternalAction::check() +{ + if(builder.get_dry_run()) + { + signal_done.emit(); + return 0; + } + + if(!pid) + return exit_code; + + int status; + if(waitpid(pid, &status, WNOHANG)==pid) + { + signal_done.emit(); + if(WIFEXITED(status)) + exit_code=WEXITSTATUS(status); + else + exit_code=254; + pid=0; + return exit_code; + } + else + return -1; +}