Don't pass empty arguments to ninja

Passing an empty argument in argv to ninja results in an error:
ninja: error: empty path

Don't add jarg to the argument list if it is empty.

Bug: 34392351
Test: m -j
Change-Id: I39c8998c79b09835650628e1413ae7625cdbc555
This commit is contained in:
Colin Cross 2017-01-18 21:12:28 -08:00
parent ba55c623cb
commit 524c868107
1 changed files with 6 additions and 2 deletions

View File

@ -338,13 +338,17 @@ int main(int argc, char* argv[]) {
// ninja is parallel by default, pass -j1 to disable parallelism if make wasn't parallel
args.push_back(strdup("-j1"));
} else {
args.push_back(strdup(jarg.c_str()));
if (jarg != "") {
args.push_back(strdup(jarg.c_str()));
}
}
if (keep_going) {
args.push_back(strdup("-k0"));
}
} else {
args.push_back(strdup(jarg.c_str()));
if (jarg != "") {
args.push_back(strdup(jarg.c_str()));
}
}
args.insert(args.end(), &argv[2], &argv[argc]);