Skip to content

Crash with native Win IO

Summary

New native Win I/O crashes a simple ansi-terminal program.

Steps to reproduce

  • boot your Win machine;
  • fetch GHC 9.2.*;
  • init a simple cabal project, adding ansi-terminal as a dependency, and add with-rtsopts=--io-manager=native in ghc-options;
  • in Main.hs, write
    module Main where
    
    import System.Console.ANSI
    
    main :: IO ()
    main = do
      clearScreen
  • run it and see it crash with {handle: <stdout>}: handleToHANDLE: inappropriate type (not a file HANDLE).

Expected behavior

Program clears screen, does not crash.

Environment

x86_64-mingw32

Comment

I have filed a bug against ansi-terminal, the maintainer sent me here. According to packdeps ansi-terminal has 254 reverse dependencies.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information