diff options
author | Michael Denkowski <mdenkows@cs.cmu.edu> | 2014-03-20 14:21:17 -0700 |
---|---|---|
committer | Michael Denkowski <mdenkows@cs.cmu.edu> | 2014-03-20 14:21:17 -0700 |
commit | 8e9652cf595aafa4acc7d67de967afdbca71ac75 (patch) | |
tree | c05fada988ed75d5c1751c380c0fedd3beea0203 | |
parent | 3cfb30225123e56e7ba85f5c92c79c16ffff995f (diff) |
Include full argv (including command) as arg 2 of execvp()
-rw-r--r-- | mteval/external_scorer.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mteval/external_scorer.cc b/mteval/external_scorer.cc index efd880fe..054c279e 100644 --- a/mteval/external_scorer.cc +++ b/mteval/external_scorer.cc @@ -63,10 +63,10 @@ ScoreServer::ScoreServer(const string& cmd) { cerr << "Exec'ing from child " << cmd << endl; vector<string> vargs; SplitOnWhitespace(cmd, &vargs); - const char** cargv = static_cast<const char**>(malloc(sizeof(const char*) * vargs.size())); - for (unsigned i = 1; i < vargs.size(); ++i) cargv[i-1] = vargs[i].c_str(); - cargv[vargs.size() - 1] = NULL; - execvp(vargs[0].c_str(), (char* const*)cargv); + const char** cargv = static_cast<const char**>(malloc(sizeof(const char*) * (vargs.size() + 1))); + for (unsigned i = 0; i < vargs.size(); i++) cargv[i] = vargs[i].c_str(); + cargv[vargs.size()] = NULL; + execvp(*cargv, (char* const*)cargv); } else { // parent close(c2p[1]); close(p2c[0]); |