Add GetAppOutput function, a better replacement for popen.
It will replace popen call in chrome_process_util_linux.
I don't see much benefit in having a Windows implementation
(not many useful programs you can launch and get output),
so POSIX-only.
Review URL: http://codereview.chromium.org/67226
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13920 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/process_util.h b/base/process_util.h
index 615e5b6..367c772 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -124,6 +124,14 @@
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
+// the output (stdout and stderr) in |output|. 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)
+
// Used to filter processes by process ID.
class ProcessFilter {
public: