java.lang.Object | |
↳ | com.pnfsoftware.jeb.util.concurrent.CommandExec |
An object to allow the execution of external commands with timeout.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CommandExec(long timeout)
Create an object with an optional timeout.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean |
execute(String... cmdarray)
Execute a command.
| ||||||||||
boolean |
execute(Collection<String> cmdlist)
| ||||||||||
byte[] |
getOutput()
Get the command output.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Create an object with an optional timeout.
timeout | timeout in milliseconds
|
---|
Execute a command. If execution takes more than the timeout provided at construction time, the executing process will be killed.
cmdarray | the command tokens (command and arguments), eg:
["ls", "-l", "*.java"] |
---|
Get the command output. There might be some output present even when the command was prematurely stopped because a timeout elapsed.