add isatty method. only useNative if isatty
This commit is contained in:
parent
1f6fabc9c1
commit
f1b13601a2
@ -15,8 +15,11 @@ import java.io.File;
|
|||||||
*/
|
*/
|
||||||
public class Getline {
|
public class Getline {
|
||||||
|
|
||||||
|
private static final boolean isatty = isatty();
|
||||||
|
|
||||||
private static boolean useNative =
|
private static boolean useNative =
|
||||||
! "false".equals(System.getProperty("sigar.getline.native"));
|
! "false".equals(System.getProperty("sigar.getline.native")) &&
|
||||||
|
isatty;
|
||||||
|
|
||||||
private BufferedReader in = null;
|
private BufferedReader in = null;
|
||||||
|
|
||||||
@ -28,6 +31,8 @@ public class Getline {
|
|||||||
this.prompt = prompt;
|
this.prompt = prompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native static boolean isatty();
|
||||||
|
|
||||||
public native static void setCompleter(GetlineCompleter completer);
|
public native static void setCompleter(GetlineCompleter completer);
|
||||||
|
|
||||||
public native void redraw();
|
public native void redraw();
|
||||||
@ -41,6 +46,10 @@ public class Getline {
|
|||||||
private native String getline(String prompt)
|
private native String getline(String prompt)
|
||||||
throws IOException, EOFException;
|
throws IOException, EOFException;
|
||||||
|
|
||||||
|
public static boolean isTTY() {
|
||||||
|
return isatty;
|
||||||
|
}
|
||||||
|
|
||||||
public String getLine()
|
public String getLine()
|
||||||
throws IOException, EOFException {
|
throws IOException, EOFException {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user