3 This file is part of builder
4 Copyright © 2006-2009 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
18 string run_command(const StringList &argv)
28 char *argv_[argv.size()+1];
31 for(StringList::const_iterator i=argv.begin(); i!=argv.end(); ++i)
32 argv_[j++]=strdup(i->c_str());
38 int devnull=open("/dev/null", O_WRONLY);
42 execvp(argv_[0], argv_);
46 cerr<<"Failed to execute "<<argv.front()<<'\n';
53 int len=read(pfd[0], buf, sizeof(buf));
56 if(waitpid(pid, 0, WNOHANG))
60 result.append(buf, len);