X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fexternalaction.cpp;h=14657a04ab2c05cfa71d059be4b6c1bbad75a7ca;hb=bdc8b6638b486aa668b4a9c6c5cce5f6b5f18222;hp=0ae68ff05f30bd297b314de7a77ac3e471192cb0;hpb=74266a6e650f019063cdcd1c9a7bd26d8f99041b;p=builder.git diff --git a/source/externalaction.cpp b/source/externalaction.cpp index 0ae68ff..14657a0 100644 --- a/source/externalaction.cpp +++ b/source/externalaction.cpp @@ -1,6 +1,15 @@ +/* $Id$ + +This file is part of builder +Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + #include #include -#include +#include +#include +#include #include "builder.h" #include "externalaction.h" @@ -14,7 +23,7 @@ int ExternalAction::check() signal_done.emit(); return 0; } - + if(!pid) return exit_code; @@ -48,7 +57,7 @@ void ExternalAction::launch() } cout<<'\n'; } - + if(builder.get_dry_run()) pid=-1; else @@ -57,10 +66,16 @@ void ExternalAction::launch() if(pid==0) { char *argv_[argv.size()+1]; - for(CountingIterator i=argv.begin(); i!=argv.end(); ++i) - argv_[i.count()]=strdup(i->c_str()); - argv_[argv.size()]=0; + + unsigned j=0; + for(StringList::iterator i=argv.begin(); i!=argv.end(); ++i) + argv_[j++]=strdup(i->c_str()); + argv_[j]=0; + + if(!work_dir.empty()) + chdir(work_dir); execvp(argv_[0], argv_); + cout<<"Couldn't execute "<