This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

stty on Cygwin in java program


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]