use of org.robovm.compiler.log.InfoOutputStream in project robovm by robovm.
the class Executor method initExecutor.
private <T extends org.apache.commons.exec.Executor> T initExecutor(T executor) {
if (streamHandler == null) {
OutputStream pumpOut = null;
OutputStream pumpErr = null;
InputStream pumpIn = null;
if (out != null) {
pumpOut = out;
} else {
pumpOut = new InfoOutputStream(logger);
}
if (err != null) {
pumpErr = err;
} else {
pumpErr = new ErrorOutputStream(logger);
}
if (in != null) {
pumpIn = in;
}
if (pumpOut == System.out) {
pumpOut = new NeverCloseOutputStream(pumpOut);
}
if (pumpErr == System.err) {
pumpErr = new NeverCloseOutputStream(pumpErr);
}
executor.setStreamHandler(new PumpStreamHandler(pumpOut, pumpErr, pumpIn) {
@Override
protected Thread createPump(InputStream is, OutputStream os, boolean closeWhenExhausted) {
return super.createPump(is, os, closeOutputStreams ? true : closeWhenExhausted);
}
});
} else {
executor.setStreamHandler(streamHandler);
}
if (wd != null) {
executor.setWorkingDirectory(wd);
}
executor.setExitValue(0);
return executor;
}
Aggregations