mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Update to pty4j version 0.4. It doesn't have PTYInputStream.available any more as it was wrong (IDEA-133909), so ability to read in blocking mode should be provided in API: it is done via special sleeping policy in BaseOutputReader and override of useNonBlockingRead method in BaseOSProcessHandler.
This commit is contained in:
Generated
+1
-1
@@ -1,7 +1,7 @@
|
||||
<component name="libraryTable">
|
||||
<library name="pty4j">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/pty4j-0.3.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/pty4j-0.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
||||
@@ -268,7 +268,7 @@ libraryLicense(name: "asm-4.0-all", libraryName: "asm-4.0-all", version: "4.0",
|
||||
libraryLicense(name: "jsr305", libraryName: "jsr305", version: "snapshot", license: "BSD", url: "http://code.google.com/p/jsr-305/", licenseUrl: "http://code.google.com/p/jsr-305/source/browse/trunk/ri/LICENSE")
|
||||
libraryLicense(name: "jzlib", libraryName: "jzlib", version: "1.1.1", license: "BSD", url: "http://www.jcraft.com/jzlib/", licenseUrl: "http://www.jcraft.com/jzlib/LICENSE.txt")
|
||||
libraryLicense(name: "PureJavaComm", libraryName: "purejavacomm", version: "0.0.16", license: "BSD", url: "http://www.sparetimelabs.com/purejavacomm")
|
||||
libraryLicense(name: "pty4j", libraryName: "pty4j", version: "0.2", license: "Eclipse Public License v1.0", url: "https://github.com/traff/pty4j")
|
||||
libraryLicense(name: "pty4j", libraryName: "pty4j", version: "0.4", license: "Eclipse Public License v1.0", url: "https://github.com/traff/pty4j")
|
||||
libraryLicense(name: "JediTerm", libraryName: "jediterm-pty", version: "0.2", license: "LGPL 2", url: "https://github.com/traff/jediterm", licenseUrl: "https://github.com/traff/jediterm/blob/master/COPYING")
|
||||
libraryLicense(name: "bouncy-castle", version: "1.48", license: "MIT License", url: "http://bouncycastle.org", licenseUrl: "http://bouncycastle.org/licence.html")
|
||||
libraryLicense(name: "kXML2", libraryName: "kxml2", version: "2.3.0", license: "BSD", url: "http://sourceforge.net/projects/kxml/")
|
||||
|
||||
Binary file not shown.
@@ -53,7 +53,7 @@ oromatcher.jar
|
||||
picocontainer.jar
|
||||
protobuf-2.5.0.jar
|
||||
proxy-vole_20131209.jar
|
||||
pty4j-0.3.jar
|
||||
pty4j-0.4.jar
|
||||
purejavacomm.jar
|
||||
resolver.jar
|
||||
rhino-js-1_7R4.jar
|
||||
|
||||
@@ -69,6 +69,14 @@ public class BaseOSProcessHandler extends ProcessHandler implements TaskExecutor
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to read process output and error streams in blocking mode
|
||||
* @return true to read non-blocking but sleeping, false for blocking read
|
||||
*/
|
||||
protected boolean useNonBlockingRead() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean processHasSeparateErrorStream() {
|
||||
return true;
|
||||
}
|
||||
@@ -117,7 +125,13 @@ public class BaseOSProcessHandler extends ProcessHandler implements TaskExecutor
|
||||
}
|
||||
|
||||
private BaseDataReader.SleepingPolicy getPolicy() {
|
||||
return useAdaptiveSleepingPolicyWhenReadingOutput() ? new AdaptiveSleepingPolicy() : BaseDataReader.SleepingPolicy.SIMPLE;
|
||||
if (useNonBlockingRead()) {
|
||||
return useAdaptiveSleepingPolicyWhenReadingOutput() ? new AdaptiveSleepingPolicy() : BaseDataReader.SleepingPolicy.SIMPLE;
|
||||
}
|
||||
else {
|
||||
//use blocking read policy
|
||||
return BaseDataReader.SleepingPolicy.BLOCKING;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -143,10 +157,10 @@ public class BaseOSProcessHandler extends ProcessHandler implements TaskExecutor
|
||||
}
|
||||
|
||||
private Reader createInputStreamReader(InputStream streamToRead) {
|
||||
final Charset charset = getCharset();
|
||||
Charset charset = getCharset();
|
||||
if (charset == null) {
|
||||
// use default charset
|
||||
return new InputStreamReader(streamToRead);
|
||||
charset = Charset.defaultCharset();
|
||||
}
|
||||
return new InputStreamReader(streamToRead, charset);
|
||||
}
|
||||
|
||||
@@ -62,6 +62,16 @@ public abstract class BaseDataReader {
|
||||
}
|
||||
};
|
||||
|
||||
SleepingPolicy BLOCKING = new SleepingPolicy() {
|
||||
@Override
|
||||
public int getTimeToSleep(boolean wasActive) {
|
||||
// in blocking mode we need to sleep only when we have reached end of the stream
|
||||
// so it can be a long sleeping
|
||||
return 50;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int getTimeToSleep(boolean wasActive);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ public abstract class BaseOutputReader extends BaseDataReader {
|
||||
|
||||
@Override
|
||||
protected boolean readAvailable() throws IOException {
|
||||
return readAvailableNonBlocking();
|
||||
return mySleepingPolicy == SleepingPolicy.BLOCKING ? readAvailableBlocking() : readAvailableNonBlocking();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,6 +57,11 @@ public class TerminalProcessHandler extends SvnProcessHandler {
|
||||
process.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean useNonBlockingRead() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyTextAvailable(String text, Key outputType) {
|
||||
terminalOutputCapturer.onTextAvailable(new ProcessEvent(this, text), outputType);
|
||||
|
||||
Reference in New Issue
Block a user