Package org.locationtech.jtstest.util
Class CommandRunner
- java.lang.Object
-
- org.locationtech.jtstest.util.CommandRunner
-
public class CommandRunner extends Object
Runs an OS command, capturing stdout and stderr- Author:
- Martin Davis
-
-
Constructor Summary
Constructors Constructor Description CommandRunner()
-
-
-
Method Detail
-
exec
public int exec(String cmd) throws IOException, InterruptedException
- Throws:
IOException
InterruptedException
-
exec
public int exec(String cmd, String stdinData) throws IOException, InterruptedException
Executes a command and returns the contents of stdout as a string. The command should be a single line, otherwise things seem to hang.- Parameters:
cmd
- command to execute (should be a single line)stdin
-- Returns:
- text of stdout
- Throws:
IOException
InterruptedException
-
getStdout
public String getStdout()
-
getStderr
public String getStderr()
-
-