diff --git a/platform/util/src/com/intellij/util/io/BaseInputStreamReader.java b/platform/util/src/com/intellij/util/io/BaseInputStreamReader.java
index c76316fc8b57..5755b59ef60f 100644
--- a/platform/util/src/com/intellij/util/io/BaseInputStreamReader.java
+++ b/platform/util/src/com/intellij/util/io/BaseInputStreamReader.java
@@ -15,6 +15,7 @@
*/
package com.intellij.util.io;
+import com.pty4j.unix.PTYInputStream;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
@@ -42,4 +43,8 @@ public class BaseInputStreamReader extends InputStreamReader {
public void close() throws IOException {
myInputStream.close(); // close underlying input stream without locking in StreamDecoder.
}
+
+ public boolean availableUnsupported() {
+ return myInputStream instanceof PTYInputStream;
+ }
}
diff --git a/platform/util/src/com/intellij/util/io/BaseOutputReader.java b/platform/util/src/com/intellij/util/io/BaseOutputReader.java
index 9c810b674efa..2e73ddff7870 100644
--- a/platform/util/src/com/intellij/util/io/BaseOutputReader.java
+++ b/platform/util/src/com/intellij/util/io/BaseOutputReader.java
@@ -93,6 +93,7 @@ public abstract class BaseOutputReader extends BaseDataReader {
* @throws IOException If an I/O error occurs
*/
protected final boolean readAvailableBlocking() throws IOException {
+ final boolean availableUnsupported = ((BaseInputStreamReader)myReader).availableUnsupported();
boolean read = false;
int n;
@@ -101,14 +102,19 @@ public abstract class BaseOutputReader extends BaseDataReader {
read = true;
processLine(myInputBuffer, myLineBuffer, n);
}
- if (!myReader.ready()) {
+
+ boolean isReady = availableUnsupported || myReader.ready();
+
+ if (!isReady) {
TimeoutUtil.sleep(mySleepingPolicy.getTimeToSleep(n > 0));
- if (!myReader.ready()) {
- if (myLineBuffer.length() > 0) {
- sendLine(myLineBuffer);
- }
- onBufferExhaustion();
+ isReady = myReader.ready();
+ }
+
+ if (!isReady) {
+ if (myLineBuffer.length() > 0) {
+ sendLine(myLineBuffer);
}
+ onBufferExhaustion();
}
}
diff --git a/platform/util/util.iml b/platform/util/util.iml
index 8f5faea7dfc2..fe6437ebbc27 100644
--- a/platform/util/util.iml
+++ b/platform/util/util.iml
@@ -23,6 +23,7 @@
+