diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 21:44:12 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 21:44:12 +0000 |
commit | 1e312119668de456111dbbf3b3a8de29485f8b73 (patch) | |
tree | 4638a0c3b8908bef6953728a3f6ba3648840b220 /base/process_util.h | |
parent | 57750f829d2a0f7850a6f2100d8db84624993bb3 (diff) | |
download | chromium_src-1e312119668de456111dbbf3b3a8de29485f8b73.zip chromium_src-1e312119668de456111dbbf3b3a8de29485f8b73.tar.gz chromium_src-1e312119668de456111dbbf3b3a8de29485f8b73.tar.bz2 |
This CL adds a utility method that lets you start a process and block until the process terminates, and retrieve what the process printed to the standard output.
That util function is needed for the new in-process test framework.
It is Windows only for now.
BUG=None
TEST=Covered by new unit test.
Review URL: http://codereview.chromium.org/87008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14135 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util.h')
-rw-r--r-- | base/process_util.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/base/process_util.h b/base/process_util.h index 20cdd5e..9eb8690 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -119,19 +119,25 @@ bool LaunchApp(const std::vector<std::string>& argv, bool wait, ProcessHandle* process_handle); #endif -// Execute the application specified by cl. This function delegates to one +// Executes the application specified by cl. This function delegates to one // of the above two platform-specific functions. bool LaunchApp(const CommandLine& cl, bool wait, bool start_hidden, ProcessHandle* process_handle); -#if defined(OS_POSIX) -// Execute the application specified by |cl| and wait for it to exit. Store +#if defined(OS_WIN) +// Executes the application specified by |cmd_line| and copies the contents +// printed to the standard output to |output|, which should be non NULL. +// Blocks until the started process terminates. +// Returns true if the application was run successfully, false otherwise. +bool GetAppOutput(const std::wstring& cmd_line, std::string* output); +#elif defined(OS_POSIX) +// Executes the application specified by |cl| and wait for it to exit. Stores // the output (stdout) in |output|. Redirects stderr to /dev/null. Returns true // on success (application launched and exited cleanly, with exit code // indicating success). |output| is modified only when the function finished // successfully. bool GetAppOutput(const CommandLine& cl, std::string* output); -#endif // defined(OS_POSIX) +#endif // Used to filter processes by process ID. class ProcessFilter { |