delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/07/08/07:55:23

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:to:from:subject:date:message-id:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=rOa
Wm8EH5f4cERASJc4jo5xtYyNTmky7QFnZprNd/1g9TvCPNXPy31xPvuxHGsvXfj+
BYj0CUpaNWaO7/jbVbw8pn8F4RVvClVpS0cF/bnTXOR03l9fl3nCmWiavVWkA/Dr
Vu6Z1D6UbxAvT/0anKYuW0M4EeGeBjTZ5/p9MbcI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:to:from:subject:date:message-id:mime-version
:content-type:content-transfer-encoding; s=default; bh=/3Y8sSKSO
+UX7HAwDC86Dzn7nL8=; b=nwWZh2JBaD5N2tmfC+DURcnEG9taIVpznRH8U1ZWI
9qMFAXwlXvNmCrXjF7QEwJ8R2Av8GUp9o95zbJAmS0WPdYYrsU/0Yyk8DQziKrrT
nPYPFCUL3HWtk2pb0fnoOfwRvTW3/gAn6lXSdZClTwksHr2+r6zoboMp4WFtXFjd
5A=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,T_FRT_BELOW2 autolearn=ham version=3.3.1
To: cygwin AT cygwin DOT com
From: Jin Zhao <jin DOT x DOT zhao AT oracle DOT com>
Subject: stty on Cygwin in java program
Date: Mon, 8 Jul 2013 11:53:31 +0000 (UTC)
Lines: 43
Message-ID: <loom.20130708T134811-605@post.gmane.org>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019