- java.lang.Object
-
- net.morimekta.io.proc.SubProcess.Runner
-
- Enclosing class:
- SubProcess
public static class SubProcess.Runner extends Object
Fluent runner class for simple subprocess handling.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SubProcess
run()
Run the subprocess.SubProcess.Runner
withDeadlineFlushMs(long deadlineFlushMs)
SubProcess.Runner
withDeadlineMs(long deadlineMs)
SubProcess.Runner
withErr(OutputStream err)
Set output stream to receive the error output from process.SubProcess.Runner
withIn(InputStream in)
Set input stream for the subprocess.SubProcess.Runner
withOut(OutputStream out)
Set output stream to receive the standard output from process.SubProcess.Runner
withRuntime(Runtime runtime)
SubProcess.Runner
withThreadFactory(ThreadFactory threadFactory)
SubProcess.Runner
withWorkingDir(Path workingDir)
-
-
-
Method Detail
-
withErr
public SubProcess.Runner withErr(OutputStream err)
Set output stream to receive the error output from process. The stream will be forked between theSubProcess.getError()
handling and the provided stream.- Parameters:
err
- The error stream.- Returns:
- The builder.
-
withOut
public SubProcess.Runner withOut(OutputStream out)
Set output stream to receive the standard output from process. The stream will be forked between theSubProcess.getOutput()
handling and the provided stream.- Parameters:
out
- The output stream.- Returns:
- The builder.
-
withIn
public SubProcess.Runner withIn(InputStream in)
Set input stream for the subprocess.- Parameters:
in
- The input stream.- Returns:
- The builder.
-
withWorkingDir
public SubProcess.Runner withWorkingDir(Path workingDir)
- Parameters:
workingDir
- The working dir of the process to be run in.- Returns:
- The builder.
-
withRuntime
public SubProcess.Runner withRuntime(Runtime runtime)
- Parameters:
runtime
- The runtime to use to run the subprocess.- Returns:
- The builder.
-
withThreadFactory
public SubProcess.Runner withThreadFactory(ThreadFactory threadFactory)
- Parameters:
threadFactory
- Thread factory for creating threads for handling IO.- Returns:
- The builder.
-
withDeadlineMs
public SubProcess.Runner withDeadlineMs(long deadlineMs)
- Parameters:
deadlineMs
- Deadline for the process to complete.- Returns:
- The builder.
-
withDeadlineFlushMs
public SubProcess.Runner withDeadlineFlushMs(long deadlineFlushMs)
- Parameters:
deadlineFlushMs
- Deadline for flushing IO streams.- Returns:
- The builder.
-
run
public SubProcess run() throws IOException
Run the subprocess.- Returns:
- The subprocess response.
- Throws:
IOException
- If executing failed.
-
-