| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/namespace contains utility functions for enumerating, ending and | 5 // This file/namespace contains utility functions for enumerating, ending and |
| 6 // computing statistics of processes. | 6 // computing statistics of processes. |
| 7 | 7 |
| 8 #ifndef BASE_PROCESS_UTIL_H_ | 8 #ifndef BASE_PROCESS_UTIL_H_ |
| 9 #define BASE_PROCESS_UTIL_H_ | 9 #define BASE_PROCESS_UTIL_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 // given environment and the list of changes given in |changes|. Each key in | 351 // given environment and the list of changes given in |changes|. Each key in |
| 352 // the environment is matched against the first element of the pairs. In the | 352 // the environment is matched against the first element of the pairs. In the |
| 353 // event of a match, the value is replaced by the second of the pair, unless | 353 // event of a match, the value is replaced by the second of the pair, unless |
| 354 // the second is empty, in which case the key-value is removed. | 354 // the second is empty, in which case the key-value is removed. |
| 355 // | 355 // |
| 356 // The returned array is allocated using new[] and must be freed by the caller. | 356 // The returned array is allocated using new[] and must be freed by the caller. |
| 357 BASE_API char** AlterEnvironment(const environment_vector& changes, | 357 BASE_API char** AlterEnvironment(const environment_vector& changes, |
| 358 const char* const* const env); | 358 const char* const* const env); |
| 359 #endif // defined(OS_POSIX) | 359 #endif // defined(OS_POSIX) |
| 360 | 360 |
| 361 // Executes the application specified by cl. This function delegates to one | |
| 362 // of the above platform-specific functions. | |
| 363 // TODO(evan): deprecated; change callers to use LaunchProcess, remove. | |
| 364 inline bool LaunchApp(const CommandLine& cl, bool wait, bool start_hidden, | |
| 365 ProcessHandle* process_handle) { | |
| 366 LaunchOptions options; | |
| 367 options.wait = wait; | |
| 368 options.process_handle = process_handle; | |
| 369 | |
| 370 return LaunchProcess(cl, options); | |
| 371 } | |
| 372 | |
| 373 // Executes the application specified by |cl| and wait for it to exit. Stores | 361 // Executes the application specified by |cl| and wait for it to exit. Stores |
| 374 // the output (stdout) in |output|. Redirects stderr to /dev/null. Returns true | 362 // the output (stdout) in |output|. Redirects stderr to /dev/null. Returns true |
| 375 // on success (application launched and exited cleanly, with exit code | 363 // on success (application launched and exited cleanly, with exit code |
| 376 // indicating success). | 364 // indicating success). |
| 377 BASE_API bool GetAppOutput(const CommandLine& cl, std::string* output); | 365 BASE_API bool GetAppOutput(const CommandLine& cl, std::string* output); |
| 378 | 366 |
| 379 #if defined(OS_POSIX) | 367 #if defined(OS_POSIX) |
| 380 // A restricted version of |GetAppOutput()| which (a) clears the environment, | 368 // A restricted version of |GetAppOutput()| which (a) clears the environment, |
| 381 // and (b) stores at most |max_output| bytes; also, it doesn't search the path | 369 // and (b) stores at most |max_output| bytes; also, it doesn't search the path |
| 382 // for the command. | 370 // for the command. |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 // instance running inside the parent. The parent's Breakpad instance should | 738 // instance running inside the parent. The parent's Breakpad instance should |
| 751 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 739 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
| 752 // in the child after forking will restore the standard exception handler. | 740 // in the child after forking will restore the standard exception handler. |
| 753 // See http://crbug.com/20371/ for more details. | 741 // See http://crbug.com/20371/ for more details. |
| 754 void RestoreDefaultExceptionHandler(); | 742 void RestoreDefaultExceptionHandler(); |
| 755 #endif // defined(OS_MACOSX) | 743 #endif // defined(OS_MACOSX) |
| 756 | 744 |
| 757 } // namespace base | 745 } // namespace base |
| 758 | 746 |
| 759 #endif // BASE_PROCESS_UTIL_H_ | 747 #endif // BASE_PROCESS_UTIL_H_ |
| OLD | NEW |