in src/java/org/jetbrains/plugins/clojure/repl/ClojureReplProcessHandler.java [199:254]
public void startNotify() {
final ReadProcessThread stdoutThread = new ReadProcessThread(createProcessOutReader()) {
protected void textAvailable(String s) {
notifyTextAvailable(s, ProcessOutputTypes.STDOUT);
}
};
final ReadProcessThread stderrThread = new ReadProcessThread(createProcessErrReader()) {
protected void textAvailable(String s) {
notifyTextAvailable(s, ProcessOutputTypes.STDERR);
}
};
//notifyTextAvailable(myCommandLine + '\n', ProcessOutputTypes.SYSTEM);
addProcessListener(new ProcessAdapter() {
public void startNotified(final ProcessEvent event) {
try {
final Future<?> stdOutReadingFuture = executeOnPooledThread(stdoutThread);
final Future<?> stdErrReadingFuture = executeOnPooledThread(stderrThread);
final Runnable action = new Runnable() {
public void run() {
int exitCode = 0;
try {
exitCode = myWaitFor.waitFor();
// tell threads that no more attempts to read process' output should be made
stderrThread.setProcessTerminated(true);
stdoutThread.setProcessTerminated(true);
stdErrReadingFuture.get();
stdOutReadingFuture.get();
}
catch (InterruptedException e) {
// Do nothing
}
catch (ExecutionException e) {
// Do nothing
}
onOSProcessTerminated(exitCode);
}
};
executeOnPooledThread(action);
}
finally {
removeProcessListener(this);
}
}
});
super.startNotify();
}