mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CPP-6325 Do not sleep in readAvailableBlocking() for pty, things won't become better anyway
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<orderEntry type="library" name="batik" level="project" />
|
||||
<orderEntry type="library" name="xmlgraphics-commons" level="project" />
|
||||
<orderEntry type="library" name="xml-apis-ext" level="project" />
|
||||
<orderEntry type="library" name="pty4j" level="project" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
Reference in New Issue
Block a user