public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* stty on Cygwin in java program
@ 2013-07-08 15:09 Jin Zhao
  0 siblings, 0 replies; only message in thread
From: Jin Zhao @ 2013-07-08 15:09 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-08 11:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-08 15:09 stty on Cygwin in java program Jin Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).