public class RunShellCommand
extends java.lang.Object
Light weight utility class for running shell commands.
Modifier and Type | Class and Description |
---|---|
static class |
RunShellCommand.ProcessResult
The text output and return code of a completed process
|
Constructor and Description |
---|
RunShellCommand()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
commitSeppuku() |
void |
enableLogging(boolean enable)
If logging is enabled, all command will be logged
|
static int |
getSpawnedProcessPid(java.lang.String processName,
java.lang.String packageName)
return the PID of a given process name started a given package name
|
static void |
killSpawnedProcess(java.lang.String processName,
java.lang.String packageName)
Kill any spawn processes matching a given process name
|
RunShellCommand.ProcessResult |
run(java.lang.String cmd)
Run the given command
|
RunShellCommand.ProcessResult |
runAsRoot(java.lang.String cmd)
Run the given command, as root
|
public void enableLogging(boolean enable)
enable
- true to enablepublic RunShellCommand.ProcessResult run(java.lang.String cmd)
cmd
- command to runpublic RunShellCommand.ProcessResult runAsRoot(java.lang.String cmd)
cmd
- command to runpublic void commitSeppuku()
public static void killSpawnedProcess(java.lang.String processName, java.lang.String packageName) throws RobotCoreException
processName
- name of process to killpackageName
- name of this packageRobotCoreException
- if unable to kill processpublic static int getSpawnedProcessPid(java.lang.String processName, java.lang.String packageName)
processName
- name of process to search forpackageName
- name of this package