Skip to content

ghc -e sometimes spills control characters into its output

The behaviour depends on the TERM variable. For example,

# TERM=xterm ghc -e 'return ()' | od -a
0000000 esc   [   ?   1   0   3   4   h
0000010

Workaround: unset the TERM variable.

Analysis: Those control characters are emitted by libreadline on initialisation. They enable the terminal's meta mode.

Trac metadata
Trac field Value
Version 6.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information