| Index: base/process_util_linux.cc
|
| ===================================================================
|
| --- base/process_util_linux.cc (revision 21122)
|
| +++ base/process_util_linux.cc (working copy)
|
| @@ -7,11 +7,12 @@
|
| #include <ctype.h>
|
| #include <dirent.h>
|
| #include <fcntl.h>
|
| -#include <string>
|
| #include <sys/types.h>
|
| #include <sys/wait.h>
|
| #include <unistd.h>
|
|
|
| +#include <string>
|
| +
|
| #include "base/eintr_wrapper.h"
|
| #include "base/file_util.h"
|
| #include "base/logging.h"
|
| @@ -86,6 +87,7 @@
|
| }
|
|
|
| bool LaunchApp(const std::vector<std::string>& argv,
|
| + const environment_vector& environ,
|
| const file_handle_mapping_vector& fds_to_remap,
|
| bool wait, ProcessHandle* process_handle) {
|
| pid_t pid = fork();
|
| @@ -93,12 +95,24 @@
|
| return false;
|
|
|
| if (pid == 0) {
|
| + // Child process
|
| InjectiveMultimap fd_shuffle;
|
| for (file_handle_mapping_vector::const_iterator
|
| it = fds_to_remap.begin(); it != fds_to_remap.end(); ++it) {
|
| fd_shuffle.push_back(InjectionArc(it->first, it->second, false));
|
| }
|
|
|
| + for (environment_vector::const_iterator it = environ.begin();
|
| + it != environ.end(); ++it) {
|
| + if (it->first) {
|
| + if (it->second) {
|
| + setenv(it->first, it->second, 1);
|
| + } else {
|
| + unsetenv(it->first);
|
| + }
|
| + }
|
| + }
|
| +
|
| if (!ShuffleFileDescriptors(fd_shuffle))
|
| exit(127);
|
|
|
| @@ -118,6 +132,7 @@
|
| << ", errno " << errno;
|
| exit(127);
|
| } else {
|
| + // Parent process
|
| if (wait)
|
| HANDLE_EINTR(waitpid(pid, 0, 0));
|
|
|
| @@ -128,6 +143,13 @@
|
| return true;
|
| }
|
|
|
| +bool LaunchApp(const std::vector<std::string>& argv,
|
| + const file_handle_mapping_vector& fds_to_remap,
|
| + bool wait, ProcessHandle* process_handle) {
|
| + base::environment_vector no_env;
|
| + return LaunchApp(argv, no_env, fds_to_remap, wait, process_handle);
|
| +}
|
| +
|
| bool LaunchApp(const CommandLine& cl,
|
| bool wait, bool start_hidden,
|
| ProcessHandle* process_handle) {
|
|
|