OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "tools/gn/exec_process.h" | 5 #include "tools/gn/exec_process.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <memory> |
| 10 |
9 #include "base/command_line.h" | 11 #include "base/command_line.h" |
10 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/process/kill.h" | 14 #include "base/process/kill.h" |
14 #include "base/process/launch.h" | 15 #include "base/process/launch.h" |
15 #include "base/process/process.h" | 16 #include "base/process/process.h" |
16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
17 | 18 |
18 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
19 #include <windows.h> | 20 #include <windows.h> |
20 | 21 |
21 #include "base/win/scoped_handle.h" | 22 #include "base/win/scoped_handle.h" |
22 #include "base/win/scoped_process_information.h" | 23 #include "base/win/scoped_process_information.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 std::string* std_out, | 151 std::string* std_out, |
151 std::string* std_err, | 152 std::string* std_err, |
152 int* exit_code) { | 153 int* exit_code) { |
153 *exit_code = EXIT_FAILURE; | 154 *exit_code = EXIT_FAILURE; |
154 | 155 |
155 std::vector<std::string> argv = cmdline.argv(); | 156 std::vector<std::string> argv = cmdline.argv(); |
156 | 157 |
157 int out_fd[2], err_fd[2]; | 158 int out_fd[2], err_fd[2]; |
158 pid_t pid; | 159 pid_t pid; |
159 base::InjectiveMultimap fd_shuffle1, fd_shuffle2; | 160 base::InjectiveMultimap fd_shuffle1, fd_shuffle2; |
160 scoped_ptr<char*[]> argv_cstr(new char*[argv.size() + 1]); | 161 std::unique_ptr<char* []> argv_cstr(new char*[argv.size() + 1]); |
161 | 162 |
162 fd_shuffle1.reserve(3); | 163 fd_shuffle1.reserve(3); |
163 fd_shuffle2.reserve(3); | 164 fd_shuffle2.reserve(3); |
164 | 165 |
165 if (pipe(out_fd) < 0) | 166 if (pipe(out_fd) < 0) |
166 return false; | 167 return false; |
167 base::ScopedFD out_read(out_fd[0]), out_write(out_fd[1]); | 168 base::ScopedFD out_read(out_fd[0]), out_write(out_fd[1]); |
168 | 169 |
169 if (pipe(err_fd) < 0) | 170 if (pipe(err_fd) < 0) |
170 return false; | 171 return false; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 return process.WaitForExit(exit_code); | 251 return process.WaitForExit(exit_code); |
251 } | 252 } |
252 } | 253 } |
253 | 254 |
254 return false; | 255 return false; |
255 } | 256 } |
256 #endif | 257 #endif |
257 | 258 |
258 } // namespace internal | 259 } // namespace internal |
259 | 260 |
OLD | NEW |