Skip to content
Snippets Groups Projects
  • Ryan Scott's avatar
    6fe9b057
    Properly detect MinTTY when running GHCi on Windows · 6fe9b057
    Ryan Scott authored
    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
    6fe9b057
    History
    Properly detect MinTTY when running GHCi on Windows
    Ryan Scott authored
    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
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
isMinTTY.c 868 B