fix how launched script output is collected - it is terminated a bit earlier now
diff --git a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/ScriptLaunchUtil.java b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/ScriptLaunchUtil.java
index d363acf..d7b4510 100644
--- a/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/ScriptLaunchUtil.java
+++ b/core/plugins/org.eclipse.dltk.launching/src/org/eclipse/dltk/launching/ScriptLaunchUtil.java
@@ -11,6 +11,7 @@
import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map;
@@ -196,6 +197,33 @@
return runScript(natureId, environment.getId(), config, monitor);
}
+ private static class ErrorStreamReaderThread extends Thread {
+
+ final InputStream stream;
+
+ /**
+ * @param stream
+ */
+ public ErrorStreamReaderThread(InputStream stream) {
+ this.stream = stream;
+ }
+
+ /*
+ * @see java.lang.Thread#run()
+ */
+ public void run() {
+ byte[] buffer = new byte[256];
+ try {
+ while (stream.read(buffer) != -1) {
+ // ignore
+ }
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
+ }
+
/**
* Read content from specified stream.
*
@@ -224,7 +252,9 @@
final Process process = ScriptLaunchUtil
.runScriptWithInterpreter(exeEnv, installLocations
.toOSString(), config);
- Thread readerThread = new Thread(new Runnable() {
+ process.getOutputStream().close();
+ new ErrorStreamReaderThread(process.getErrorStream()).start();
+ Thread readerThread = new Thread(scriptPath) {
public void run() {
BufferedReader input = null;
try {
@@ -253,7 +283,7 @@
}
}
}
- });
+ };
try {
readerThread.start();
readerThread.join(10000);