summaryrefslogtreecommitdiffstats
path: root/base/process_util.h
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-22 01:15:47 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-22 01:15:47 +0000
commitfb7f9bef3ceecd5a3efb9252410f6850320462b8 (patch)
tree95cefb13965daa20689cebec67e48352be1ccfbf /base/process_util.h
parent0cbd643274f17abca0efaa82036ac8ccbc695be3 (diff)
downloadchromium_src-fb7f9bef3ceecd5a3efb9252410f6850320462b8.zip
chromium_src-fb7f9bef3ceecd5a3efb9252410f6850320462b8.tar.gz
chromium_src-fb7f9bef3ceecd5a3efb9252410f6850320462b8.tar.bz2
Added linux process utilities and tests.
Review URL: http://codereview.chromium.org/7202 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util.h')
-rw-r--r--base/process_util.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/base/process_util.h b/base/process_util.h
index 4f33bb0..503c2ec 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -17,6 +17,7 @@
#include <string>
+#include "base/command_line.h"
#include "base/process.h"
#if defined(OS_WIN)
@@ -47,6 +48,7 @@ ProcessHandle GetCurrentProcessHandle();
// Win XP SP1 as well.
int GetProcId(ProcessHandle process);
+#if defined(OS_WIN)
// Runs the given application name with the given command line. Normally, the
// first command line argument should be the path to the process, and don't
// forget to quote it.
@@ -63,6 +65,24 @@ int GetProcId(ProcessHandle process);
// that it doesn't leak!
bool LaunchApp(const std::wstring& cmdline,
bool wait, bool start_hidden, ProcessHandle* process_handle);
+#elif defined(OS_POSIX)
+// Runs the application specified in argv[0] with the command line argv.
+// Both the elements of argv and argv itself must be terminated with a null
+// byte.
+//
+// As above, if wait is true, execute synchronously. The pid will be stored
+// in process_handle if that pointer is non-null.
+//
+// Note that the first argument in argv must point to the filename,
+// and must be fully specified.
+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
+// of the above two platform-specific functions.
+bool LaunchApp(const CommandLine& cl,
+ bool wait, bool start_hidden, ProcessHandle* process_handle);
// Used to filter processes by process ID.
class ProcessFilter {
@@ -106,6 +126,11 @@ bool WaitForProcessesToExit(const std::wstring& executable_name,
int wait_milliseconds,
const ProcessFilter* filter);
+// Wait for a single process to exit. Return true if it exited cleanly within
+// the given time limit.
+bool WaitForSingleProcess(ProcessHandle handle,
+ int wait_milliseconds);
+
// Waits a certain amount of time (can be 0) for all the processes with a given
// executable name to exit, then kills off any of them that are still around.
// If filter is non-null, then only processes selected by the filter are waited