9 string run_command(const list<string> &argv)
19 char *argv_[argv.size()+1];
20 for(CountingIterator<const string, list<string>::const_iterator> i=argv.begin(); i!=argv.end(); ++i)
21 argv_[i.count()]=strdup(i->c_str());
26 execvp(argv_[0], argv_);
30 cerr<<"Failed to execute "<<argv.front()<<'\n';
37 int len=read(pfd[0], buf, sizeof(buf));
40 if(waitpid(pid, 0, WNOHANG))
44 result.append(buf, len);