OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This file contains functions for launching subprocesses. | 5 // This file contains functions for launching subprocesses. |
6 | 6 |
7 #ifndef BASE_PROCESS_LAUNCH_H_ | 7 #ifndef BASE_PROCESS_LAUNCH_H_ |
8 #define BASE_PROCESS_LAUNCH_H_ | 8 #define BASE_PROCESS_LAUNCH_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 BASE_EXPORT void CloseSuperfluousFds(const InjectiveMultimap& saved_map); | 229 BASE_EXPORT void CloseSuperfluousFds(const InjectiveMultimap& saved_map); |
230 #endif // defined(OS_POSIX) | 230 #endif // defined(OS_POSIX) |
231 | 231 |
232 #if defined(OS_WIN) | 232 #if defined(OS_WIN) |
233 // Set |job_object|'s JOBOBJECT_EXTENDED_LIMIT_INFORMATION | 233 // Set |job_object|'s JOBOBJECT_EXTENDED_LIMIT_INFORMATION |
234 // BasicLimitInformation.LimitFlags to |limit_flags|. | 234 // BasicLimitInformation.LimitFlags to |limit_flags|. |
235 BASE_EXPORT bool SetJobObjectLimitFlags(HANDLE job_object, DWORD limit_flags); | 235 BASE_EXPORT bool SetJobObjectLimitFlags(HANDLE job_object, DWORD limit_flags); |
236 | 236 |
237 // Output multi-process printf, cout, cerr, etc to the cmd.exe console that ran | 237 // Output multi-process printf, cout, cerr, etc to the cmd.exe console that ran |
238 // chrome. This is not thread-safe: only call from main thread. | 238 // chrome. This is not thread-safe: only call from main thread. |
239 BASE_EXPORT void RouteStdioToConsole(); | 239 BASE_EXPORT void RouteStdioToConsole(bool create_console_if_not_found); |
240 #endif // defined(OS_WIN) | 240 #endif // defined(OS_WIN) |
241 | 241 |
242 // Executes the application specified by |cl| and wait for it to exit. Stores | 242 // Executes the application specified by |cl| and wait for it to exit. Stores |
243 // the output (stdout) in |output|. Redirects stderr to /dev/null. Returns true | 243 // the output (stdout) in |output|. Redirects stderr to /dev/null. Returns true |
244 // on success (application launched and exited cleanly, with exit code | 244 // on success (application launched and exited cleanly, with exit code |
245 // indicating success). | 245 // indicating success). |
246 BASE_EXPORT bool GetAppOutput(const CommandLine& cl, std::string* output); | 246 BASE_EXPORT bool GetAppOutput(const CommandLine& cl, std::string* output); |
247 | 247 |
| 248 // Like GetAppOutput, but also includes stderr. |
| 249 BASE_EXPORT bool GetAppOutputAndError(const CommandLine& cl, |
| 250 std::string* output); |
| 251 |
248 #if defined(OS_WIN) | 252 #if defined(OS_WIN) |
249 // A Windows-specific version of GetAppOutput that takes a command line string | 253 // A Windows-specific version of GetAppOutput that takes a command line string |
250 // instead of a CommandLine object. Useful for situations where you need to | 254 // instead of a CommandLine object. Useful for situations where you need to |
251 // control the command line arguments directly. | 255 // control the command line arguments directly. |
252 BASE_EXPORT bool GetAppOutput(const StringPiece16& cl, std::string* output); | 256 BASE_EXPORT bool GetAppOutput(const StringPiece16& cl, std::string* output); |
253 #endif | 257 #endif |
254 | 258 |
255 #if defined(OS_POSIX) | 259 #if defined(OS_POSIX) |
256 // A POSIX-specific version of GetAppOutput that takes an argv array | 260 // A POSIX-specific version of GetAppOutput that takes an argv array |
257 // instead of a CommandLine. Useful for situations where you need to | 261 // instead of a CommandLine. Useful for situations where you need to |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // multiple threads are running, since at the time the fork happened, the | 316 // multiple threads are running, since at the time the fork happened, the |
313 // threads could have been in any state (potentially holding locks, etc.). | 317 // threads could have been in any state (potentially holding locks, etc.). |
314 // Callers should most likely call execve() in the child soon after calling | 318 // Callers should most likely call execve() in the child soon after calling |
315 // this. | 319 // this. |
316 BASE_EXPORT pid_t ForkWithFlags(unsigned long flags, pid_t* ptid, pid_t* ctid); | 320 BASE_EXPORT pid_t ForkWithFlags(unsigned long flags, pid_t* ptid, pid_t* ctid); |
317 #endif | 321 #endif |
318 | 322 |
319 } // namespace base | 323 } // namespace base |
320 | 324 |
321 #endif // BASE_PROCESS_LAUNCH_H_ | 325 #endif // BASE_PROCESS_LAUNCH_H_ |
OLD | NEW |