stty on Cygwin in java program

Jin Zhao jin.x.zhao@oracle.com
Mon Jul 8 15:09:00 GMT 2013


Hi,

When run 'stty -echo' from java application on Cygwin, I got the error
meesage "stty: standard input: Inappropriate ioctl for device", but it is OK
when run it from Cygwin terminal. Any idea? Thanks.

Test program is as bellow:
-------------------------------------------
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class TestSttyCygwin {

    public static void main(String[] args) {
        String[] cmd = new String[]{"c:/cygwin/bin/bash.exe", "-c", "stty
-echo"};
        try {
            Process proc = Runtime.getRuntime().exec(cmd);

            String s = null;
            StringBuilder sb = new StringBuilder();
            BufferedReader stdInput =
                new BufferedReader(new
InputStreamReader(proc.getInputStream()));
            while ((s = stdInput.readLine()) != null) {
                sb.append(s);
            }

            BufferedReader stdError =
                new BufferedReader(new
InputStreamReader(proc.getErrorStream()));
            while ((s = stdError.readLine()) != null) {
                sb.append(s);
            }

            proc.waitFor();
            System.out.println(sb.toString());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list