use of org.robovm.compiler.log.ErrorOutputStream 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;
}
use of org.robovm.compiler.log.ErrorOutputStream in project robovm by robovm.
the class AppLauncherProcess method execAsync.
@Override
public Process execAsync() throws IOException {
launcher.install();
this.launcherThread = new Thread("AppLauncherThread-" + threadCounter.getAndIncrement()) {
@Override
public void run() {
try {
exitCode = launcher.launch();
} catch (Throwable t) {
log.error("AppLauncher failed with an exception:", t.getMessage());
t.printStackTrace(new PrintStream(new ErrorOutputStream(log), true));
} finally {
IOUtils.closeQuietly(errStream);
finished = true;
countDownLatch.countDown();
}
}
};
this.launcherThread.start();
return this;
}
Aggregations