summaryrefslogtreecommitdiffstats
path: root/base/process_util.h
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-16 04:11:45 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-16 04:11:45 +0000
commit5743490811d02ea8e9a828a92bcbc8fc442a3b18 (patch)
tree2dde838bddeb501270a0e8d985a9e790414f71bb /base/process_util.h
parentc4e1cf8cc32fe095137a23e6d895d169982abf10 (diff)
downloadchromium_src-5743490811d02ea8e9a828a92bcbc8fc442a3b18.zip
chromium_src-5743490811d02ea8e9a828a92bcbc8fc442a3b18.tar.gz
chromium_src-5743490811d02ea8e9a828a92bcbc8fc442a3b18.tar.bz2
Add and alternative GetAppOutput() to process_util that takes a timeout.
Contributed by tessamac@chromium.org TEST=none BUG=47356 Review URL: http://codereview.chromium.org/2810014 Patch from Tessa MacDuff <tessamac@chromium.org>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util.h')
-rw-r--r--base/process_util.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/base/process_util.h b/base/process_util.h
index 48cef2c..db68b84 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -85,6 +85,9 @@ struct IoCounters {
// A minimalistic but hopefully cross-platform set of exit codes.
// Do not change the enumeration values or you will break third-party
// installers.
+// Warning: This enum is duplicated and extended in chrome/common/result_codes.h
+// The two must be kept in sync and users of that enum would prefer the
+// numbering didn't change.
enum {
PROCESS_END_NORMAL_TERMINATION = 0,
PROCESS_END_KILLED_BY_USER = 1,
@@ -239,6 +242,15 @@ bool LaunchApp(const CommandLine& cl,
bool GetAppOutput(const CommandLine& cl, std::string* output);
#if defined(OS_POSIX)
+// Similar to |GetAppOutput()|. Returns true if process launched and
+// exited cleanly, with exit code indicating success. Waits no more than
+// |timeout_milliseconds| for the launched process to exit. After timeout
+// is triggered, the process is killed and true is stored in |timed_out|.
+// Will wait for process to die so this may overrun |timeout_milliseconds|.
+// TODO(tessamac): implement this for windows.
+bool GetAppOutputWithTimeout(const CommandLine& cl, std::string* output,
+ bool* timed_out, int timeout_milliseconds);
+
// A restricted version of |GetAppOutput()| which (a) clears the environment,
// and (b) stores at most |max_output| bytes; also, it doesn't search the path
// for the command.