diff options
author | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-22 17:28:30 +0000 |
---|---|---|
committer | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-22 17:28:30 +0000 |
commit | 61b93f88f388e26823dfbca2c04630cc3823ecb7 (patch) | |
tree | 0d21dd8447bf22c5b635f35e21ca3dc781041d97 /base/process_util.h | |
parent | 1733651c19923ce5aaa8918f038ea106ab42c7ec (diff) | |
download | chromium_src-61b93f88f388e26823dfbca2c04630cc3823ecb7.zip chromium_src-61b93f88f388e26823dfbca2c04630cc3823ecb7.tar.gz chromium_src-61b93f88f388e26823dfbca2c04630cc3823ecb7.tar.bz2 |
Cleanup orphaned testserver processes on posix.
If a chrome test that uses a testserver were to crash, the testserver process ends up being orphaned, potentially affecting subsequent tests. This patch causes child processes of a test case to be killed along with the test case if it were to be abruptly terminated.
BUG=55808
TEST=sync_integration_tests
Review URL: http://codereview.chromium.org/3423012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60192 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util.h')
-rw-r--r-- | base/process_util.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/base/process_util.h b/base/process_util.h index e64d0a7..c513f3d 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -226,6 +226,14 @@ bool LaunchApp(const std::vector<std::string>& argv, const file_handle_mapping_vector& fds_to_remap, bool wait, ProcessHandle* process_handle); +// Similar to the above two methods, but starts the child process in a process +// group of its own, instead of allowing it to inherit the parent's process +// group. The pgid of the child process will be the same as its pid. +bool LaunchAppInNewProcessGroup(const std::vector<std::string>& argv, + const environment_vector& environ, + const file_handle_mapping_vector& fds_to_remap, + bool wait, ProcessHandle* process_handle); + // AlterEnvironment returns a modified environment vector, constructed from the // given environment and the list of changes given in |changes|. Each key in // the environment is matched against the first element of the pairs. In the @@ -276,7 +284,7 @@ int GetProcessCount(const std::wstring& executable_name, // Attempts to kill all the processes on the current machine that were launched // from the given executable name, ending them with the given exit code. If // filter is non-null, then only processes selected by the filter are killed. -// Returns false if all processes were able to be killed off, false if at least +// Returns true if all processes were able to be killed off, false if at least // one couldn't be killed. bool KillProcesses(const std::wstring& executable_name, int exit_code, const ProcessFilter* filter); @@ -286,6 +294,13 @@ bool KillProcesses(const std::wstring& executable_name, int exit_code, // for the process to be actually terminated before returning. // Returns true if this is successful, false otherwise. bool KillProcess(ProcessHandle process, int exit_code, bool wait); + +#if defined(OS_POSIX) +// Attempts to kill the process group identified by |process_group_id|. Returns +// true on success. +bool KillProcessGroup(ProcessHandle process_group_id); +#endif + #if defined(OS_WIN) bool KillProcessById(ProcessId process_id, int exit_code, bool wait); #endif |