mintty: A reliable way to detect the presence of a MinTTY console on Windows

[ bsd3, library, system ] [ Propose Tags ] [ Report a vulnerability ]

MinTTY is a Windows-specific terminal emulator for the widely used Cygwin and MSYS projects, which provide Unix-like environments for Windows. MinTTY consoles behave differently from native Windows consoles (such as cmd.exe or PowerShell) in many ways, and in some cases, these differences make it necessary to treat MinTTY consoles differently in code.

The mintty library provides a simple way to detect if your code in running in a MinTTY console on Windows. It exports isMinTTY, which does the right thing 90% of the time (by checking if standard error is attached to MinTTY), and it also exports isMinTTYHandle for the other 10% of the time (when you want to check is some arbitrary handle is attached to MinTTY). As you might expect, both of these functions will simply return False on any non-Windows operating system.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Flags

Automatic Flags
NameDescriptionDefault
win32-2-13-1

Use Win32-2.13.1.0 or later. Older versions of Win32 either do not have functionality for detecting MinTTY or have bugs in their MinTTY detection. For these versions of Win32, we backport a working version of MinTTY detection.

Enabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.1.1, 0.1.2, 0.1.3, 0.1.4 (info)
Change log CHANGELOG.md
Dependencies base (>=4.3 && <5), Win32 [details]
Tested with ghc ==7.0.4, ghc ==7.2.2, ghc ==7.4.2, ghc ==7.6.3, ghc ==7.8.4, ghc ==7.10.3, ghc ==8.0.2, ghc ==8.2.2, ghc ==8.4.4, ghc ==8.6.5, ghc ==8.8.4, ghc ==8.10.7, ghc ==9.0.2, ghc ==9.2.2
License BSD-3-Clause
Copyright (C) 2017 Ryan Scott
Author Ryan Scott
Maintainer Ryan Scott <ryan.gl.scott@gmail.com>
Category System
Home page https://github.com/RyanGlScott/mintty
Bug tracker https://github.com/RyanGlScott/mintty/issues
Source repo head: git clone https://github.com/RyanGlScott/mintty
Uploaded by ryanglscott at 2022-06-30T23:43:58Z
Distributions Arch:0.1.4, Fedora:0.1.4, LTSHaskell:0.1.4, NixOS:0.1.4, Stackage:0.1.4
Reverse Dependencies 6 direct, 4860 indirect [details]
Downloads 29894 total (91 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-07-01 [all 1 reports]

Readme for mintty-0.1.4

[back to package description]

mintty

Hackage Hackage Dependencies Haskell Programming Language BSD3 License Linux build Windows build

MinTTY is a Windows-specific terminal emulator for the widely used Cygwin and MSYS projects, which provide Unix-like environments for Windows. MinTTY consoles behave differently from native Windows consoles (such as cmd.exe or PowerShell) in many ways, and in some cases, these differences make it necessary to treat MinTTY consoles differently in code.

The mintty library provides a simple way to detect if your code in running in a MinTTY console on Windows. It exports isMinTTY, which does the right thing 90% of the time (by checking if standard error is attached to MinTTY), and it also exports isMinTTYHandle for the other 10% of the time (when you want to check is some arbitrary handle is attached to MinTTY). As you might expect, both of these functions will simply return False on any non-Windows operating system.