diff options
Diffstat (limited to 'src/browse.cc')
-rw-r--r-- | src/browse.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/browse.cc b/src/browse.cc index 8673919..46434d7 100644 --- a/src/browse.cc +++ b/src/browse.cc @@ -17,11 +17,12 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <vector> #include "build/browse_py.h" void RunBrowsePython(State* state, const char* ninja_command, - const char* initial_target) { + int argc, char* argv[]) { // Fork off a Python process and have it run our code via its stdin. // (Actually the Python process becomes the parent.) int pipefd[2]; @@ -44,11 +45,16 @@ void RunBrowsePython(State* state, const char* ninja_command, break; } - // exec Python, telling it to run the program from stdin. - const char* command[] = { - NINJA_PYTHON, "-", ninja_command, initial_target, NULL - }; - execvp(command[0], (char**)command); + std::vector<const char *> command; + command.push_back(NINJA_PYTHON); + command.push_back("-"); + command.push_back("--ninja-command"); + command.push_back(ninja_command); + for (int i = 0; i < argc; i++) { + command.push_back(argv[i]); + } + command.push_back(NULL); + execvp(command[0], (char**)&command[0]); perror("ninja: execvp"); } while (false); _exit(1); |