STDOUT.tty? returns false when running from Cygwin using rxvt (or mintty, putty)
--------------------------------------------------------------------------------

                 Key: JRUBY-5068
                 URL: http://jira.codehaus.org/browse/JRUBY-5068
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.5.1
         Environment: Cygwin 1.7
Windows Vista
Java 1.6
            Reporter: Andrew Davey
            Assignee: Thomas E Enebo


The following command will print false if you run it from cygwin using a 
terminal.

jruby -e 'puts STDOUT.tty?'

If you run the above command from cygwin using the windows console, and/or the 
Windows environment variable CYGWIN contains 'notty', then the tty? returns 
true.

The way that cygwin emulates pty's (which are needed by terminal emulators like 
rvxt and mintty etc) is to redirect stdin and stdout using pipes. 

Calling STDOUT.tty? makes a call to 'isatty' in 
org.jruby.ext.posix.WindowsPOSIX which calls the Win32 function GetFileType(). 
isatty wants GetFileType to return FILE_TYPE_CHAR, instead GetFileType sees 
that STDOUT has been redirected to a pipe (to emulate a pty) and returns 
FILE_TYPE_PIPE.

Forgive me if this is not technically a bug, since there are known issues with 
running non cygwin console apps under cygwin + term.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to