[GHC] #12958: Properly detect if GHCi is running in MinTTY

GHC ghc-devs at haskell.org
Tue Jan 10 19:21:41 UTC 2017


#12958: Properly detect if GHCi is running in MinTTY
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.2.1
       Component:  GHCi              |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Windows           |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D2878
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"6fe9b057396b4ace73106dc9c3c7fcb72a216bfa/ghc"
 6fe9b057/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="6fe9b057396b4ace73106dc9c3c7fcb72a216bfa"
 Properly detect MinTTY when running GHCi on Windows

 Before, we detecting the presence of MinTTY on Windows in a very
 imprecise way: by checking if the `_` environment variable was set. Not
 only is this easy to circumvent, but it also yields false positives on
 terminals like ConEmu.

 This changes the test to use the `GetFileInformationByHandleEx` function
 instead, which provides a far more accurate check for MinTTY's presence.
 I've tested this on PowerShell, MSYS2, Cygwin, ConEmu, and Git Bash, and
 it does the right thing on each one.

 Fixes #12958.

 Test Plan: Run GHCi on many different Windows and MinTTY consoles

 Reviewers: erikd, Phyx, austin, bgamari

 Reviewed By: Phyx, bgamari

 Subscribers: thomie, #ghc_windows_task_force

 Differential Revision: https://phabricator.haskell.org/D2878

 GHC Trac Issues: #12958
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12958#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list