add isatty method. only useNative if isatty

This commit is contained in:
Doug MacEachern 2005-07-21 04:37:45 +00:00
parent 1f6fabc9c1
commit f1b13601a2
1 changed files with 10 additions and 1 deletions

View File

@ -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 {