base::LaunchOptions fds_to_remap is no longer a pointer
https://codereview.chromium.org/2950153002
This commit is contained in:
parent
248d572077
commit
62635f43f4
2 changed files with 5 additions and 9 deletions
|
@ -87,15 +87,12 @@ bool RelaunchAppWithHelper(const base::FilePath& helper,
|
|||
internal::kRelauncherSyncFD != STDOUT_FILENO &&
|
||||
internal::kRelauncherSyncFD != STDERR_FILENO,
|
||||
"kRelauncherSyncFD must not conflict with stdio fds");
|
||||
|
||||
base::FileHandleMappingVector fd_map;
|
||||
fd_map.push_back(
|
||||
std::make_pair(pipe_write_fd.get(), internal::kRelauncherSyncFD));
|
||||
#endif
|
||||
|
||||
base::LaunchOptions options;
|
||||
#if defined(OS_POSIX)
|
||||
options.fds_to_remap = &fd_map;
|
||||
options.fds_to_remap.push_back(
|
||||
std::make_pair(pipe_write_fd.get(), internal::kRelauncherSyncFD));
|
||||
base::Process process = base::LaunchProcess(relaunch_argv, options);
|
||||
#elif defined(OS_WIN)
|
||||
base::Process process = base::LaunchProcess(
|
||||
|
|
|
@ -82,13 +82,12 @@ int LaunchProgram(const StringVector& relauncher_args,
|
|||
// Redirect the stdout of child process to /dev/null, otherwise after
|
||||
// relaunch the child process will raise exception when writing to stdout.
|
||||
base::ScopedFD devnull(HANDLE_EINTR(open("/dev/null", O_WRONLY)));
|
||||
base::FileHandleMappingVector no_stdout;
|
||||
no_stdout.push_back(std::make_pair(devnull.get(), STDERR_FILENO));
|
||||
no_stdout.push_back(std::make_pair(devnull.get(), STDOUT_FILENO));
|
||||
|
||||
base::LaunchOptions options;
|
||||
options.new_process_group = true; // detach
|
||||
options.fds_to_remap = &no_stdout;
|
||||
options.fds_to_remap.push_back(std::make_pair(devnull.get(), STDERR_FILENO));
|
||||
options.fds_to_remap.push_back(std::make_pair(devnull.get(), STDOUT_FILENO));
|
||||
|
||||
base::Process process = base::LaunchProcess(argv, options);
|
||||
return process.IsValid() ? 0 : 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue