stty -cooked not usable since cygwin-3.1.1-1

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

stty -cooked not usable since cygwin-3.1.1-1

Rabbe Fogelholm
I am running a console Java program that is started from a shellscript
wrapper. Before invoking Java the wrapper calls `stty -cooked'. The Java
program polls the keyboard using System.in.available() and reads
characters immediately using System.in.read(), without waiting for the
Enter key to be pressed.

This way of combining `stty -cooked' and Java has stopped working since
version 3.1.1-1 of the Cygwin package. The Java thread that reads the
keyboard hangs until Enter is pressed, which is not desirable.

I had to downgrade to version 3.0.7-1 to resolve the problem.

Versioning information:

java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

OS Name: Microsoft Windows 10 Pro
Version: 10.0.17763 Build 17763
System Type: x64-based PC

See also the enclosed cygcheck.out.

To demonstrate the issue I enclose a small Java program that should be
able to read single keystrokes when `stty -cooked' is in effect.

BR / Rabbe Fogelholm, Sollentuna, Sweden


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

cygcheck.out (184K) Download Attachment
DemoNonCooked.java (662 bytes) Download Attachment
DemoNonCooked.class (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: stty -cooked not usable since cygwin-3.1.1-1

Takashi Yano
On Mon, 13 Jan 2020 11:52:43 +0100
Rabbe Fogelholm wrote:

> I am running a console Java program that is started from a shellscript
> wrapper. Before invoking Java the wrapper calls `stty -cooked'. The Java
> program polls the keyboard using System.in.available() and reads
> characters immediately using System.in.read(), without waiting for the
> Enter key to be pressed.
>
> This way of combining `stty -cooked' and Java has stopped working since
> version 3.1.1-1 of the Cygwin package. The Java thread that reads the
> keyboard hangs until Enter is pressed, which is not desirable.
>
> I had to downgrade to version 3.0.7-1 to resolve the problem.
>
> Versioning information:
>
> java version "1.8.0_202"
> Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
> Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
>
> OS Name: Microsoft Windows 10 Pro
> Version: 10.0.17763 Build 17763
> System Type: x64-based PC
>
> See also the enclosed cygcheck.out.
>
> To demonstrate the issue I enclose a small Java program that should be
> able to read single keystrokes when `stty -cooked' is in effect.

Does your java program work in command prompt? cygwin 3.1.x uses
pseudo console, so the native (non cygwin) program works as if it
is executed in command prompt.

--
Takashi Yano <[hidden email]>

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

Reply | Threaded
Open this post in threaded view
|

Re: stty -cooked not usable since cygwin-3.1.1-1

Rabbe Fogelholm
Takashi Yano wrote:

> On Mon, 13 Jan 2020 11:52:43 +0100
> Rabbe Fogelholm wrote:
>> I am running a console Java program that is started from a shellscript
>> wrapper. Before invoking Java the wrapper calls `stty -cooked'. The Java
>> program polls the keyboard using System.in.available() and reads
>> characters immediately using System.in.read(), without waiting for the
>> Enter key to be pressed.
>>
>> This way of combining `stty -cooked' and Java has stopped working since
>> version 3.1.1-1 of the Cygwin package. The Java thread that reads the
>> keyboard hangs until Enter is pressed, which is not desirable.
>>
>> I had to downgrade to version 3.0.7-1 to resolve the problem.
>>
>> Versioning information:
>>
>> java version "1.8.0_202"
>> Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
>> Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
>>
>> OS Name: Microsoft Windows 10 Pro
>> Version: 10.0.17763 Build 17763
>> System Type: x64-based PC
>>
>> See also the enclosed cygcheck.out.
>>
>> To demonstrate the issue I enclose a small Java program that should be
>> able to read single keystrokes when `stty -cooked' is in effect.
>
> Does your java program work in command prompt? cygwin 3.1.x uses
> pseudo console, so the native (non cygwin) program works as if it
> is executed in command prompt.
>

With cygwin 3.1.x I can't find a way to make my program work.

When running from within a Cygwin64 terminal the `stty -cooked' command
terminates with exit code 0, but the Java program behaves just as if
`stty -cooked' is not in effect: It does not handle single keystrokes
immediately.

When running from a Windows command prompt I can execute the stty
program as \cygwin64\bin\stty. However, when given the '-cooked'
argument it complains:
/usr/bin/stty: 'standard input': unable to perform all requested operations

- and here as well the Java program behaves as if `stty -cooked' is not
in effect.

--Rabbe

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