com.github.mike10004.nativehelper.subprocess.ProcessResult Maven / Gradle / Ivy
package com.github.mike10004.nativehelper.subprocess;
import java.util.function.Function;
/**
* Interface representing a process result. A process result is an exit code
* and an object representing output from the process.
* @param type of the captured standard output contents
* @param type of the captured standard error contents
*/
public interface ProcessResult {
int exitCode();
StreamContent content();
static ProcessResult direct(int exitCode, SO stdout, SE stderr) {
return BasicProcessResult.create(exitCode, stdout, stderr);
}
static ProcessResult direct(int exitCode, StreamContent output) {
return new BasicProcessResult<>(exitCode, output);
}
default ProcessResult map(Function super SO, SO2> stdoutMap, Function super SE, SE2> stderrMap) {
return new BasicProcessResult<>(exitCode(), content().map(stdoutMap, stderrMap));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy