Package it.tidalwave.util
Interface ProcessExecutor
- All Known Implementing Classes:
DefaultProcessExecutor
@ThreadSafe
public interface ProcessExecutor
A facility that provides means for launching an external process, scraping its stdout and stderr in real-time and
sending commands by means of its stdin.
- Since:
- 1.39
- Author:
- Fabrizio Giudici
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
This interface provides operations that can be performed on the stdout or stderr consoles attached to the external process. -
Method Summary
Modifier and TypeMethodDescriptionReturns the stderr console.Returns the stdout console.Sends a string to the stdin of the running process.start()
Starts the external process.void
stop()
Stops the external process.Waits for the termination of the external process.withArgument
(String argument) Adds a single argument to pass to the external process.withArguments
(String... arguments) Adds some arguments to pass to the external process.
-
Method Details
-
withArguments
Adds some arguments to pass to the external process.- Parameters:
arguments
- the arguments- Returns:
- itself for chaining methods
-
withArgument
Adds a single argument to pass to the external process.- Parameters:
argument
- the argument- Returns:
- itself for chaining methods
-
start
Starts the external process.- Returns:
- itself for chaining methods
- Throws:
IOException
- in case of error
-
stop
void stop()Stops the external process. -
waitForCompletion
Waits for the termination of the external process.- Returns:
- itself for chaining methods
- Throws:
InterruptedException
- if the wait has been interruptedIOException
- in case of I/O error
-
send
Sends a string to the stdin of the running process. If a carriage return is needed, it must be explicitly placed in the string.- Parameters:
string
- the string to send- Returns:
- itself for chaining methods
- Throws:
IOException
- in case of I/O error
-
getStdout
Returns the stdout console.- Returns:
- the console
-
getStderr
Returns the stderr console.- Returns:
- the console
-