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 | 63a3894f2f2649787d5656adb09579e494c791d2 (patch) | |
tree | 83ab255165e69e9705c3ce5106a8fc584990ee53 | |
parent | 824ef65f3cbc50fd6d734cb1453529aaa4329fa5 (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]); |