Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6408 Depend on ansi-terminal >= 1.0.2; use hNowSupportsANSI #6412

Merged
merged 1 commit into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ dependencies:
- Cabal >= 3.8.1.0
- aeson >= 2.0.3.0
- aeson-warning-parser >= 0.1.1
- ansi-terminal >= 1.0
- ansi-terminal >= 1.0.2
- array
- async
- attoparsec
Expand Down
4 changes: 2 additions & 2 deletions src/Stack/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ import Stack.Types.Version
( IntersectingVersionRange (..), VersionCheck (..)
, stackVersion, withinRange
)
import System.Console.ANSI ( hSupportsANSI, setSGRCode )
import System.Console.ANSI ( hNowSupportsANSI, setSGRCode )
import System.Environment ( getEnvironment, lookupEnv )
import System.Info.ShortPathName ( getShortPathName )
import System.PosixCompat.Files ( fileOwner, getFileStatus )
Expand Down Expand Up @@ -433,7 +433,7 @@ configFromConfigMonoid
Just True -> pure True
_ -> getInContainer
configRunner' <- view runnerL
useAnsi <- liftIO $ hSupportsANSI stderr
useAnsi <- liftIO $ hNowSupportsANSI stderr
let stylesUpdate' = (configRunner' ^. stylesUpdateL) <>
configMonoid.configMonoidStyles
useColor' = configRunner'.runnerUseColor
Expand Down
4 changes: 2 additions & 2 deletions src/Stack/DefaultColorWhen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Stack.DefaultColorWhen

import Stack.Prelude ( stdout )
import Stack.Types.ColorWhen ( ColorWhen (..) )
import System.Console.ANSI ( hSupportsANSI )
import System.Console.ANSI ( hNowSupportsANSI )
import System.Environment ( lookupEnv )

-- | The default adopts the standard proposed at http://no-color.org/, that
Expand All @@ -15,6 +15,6 @@ import System.Environment ( lookupEnv )
defaultColorWhen :: IO ColorWhen
defaultColorWhen = lookupEnv "NO_COLOR" >>= \case
Just _ -> pure ColorNever
_ -> hSupportsANSI stdout >>= \case
_ -> hNowSupportsANSI stdout >>= \case
False -> pure ColorNever
_ -> pure ColorAuto
4 changes: 2 additions & 2 deletions src/Stack/Runners.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import Stack.Types.Runner
import Stack.Types.StackYamlLoc ( StackYamlLoc (..) )
import Stack.Types.Version
( minorVersion, stackMinorVersion, stackVersion )
import System.Console.ANSI ( hSupportsANSI )
import System.Console.ANSI ( hNowSupportsANSI )
import System.Terminal ( getTerminalWidth )

-- | Type representing exceptions thrown by functions exported by the
Expand Down Expand Up @@ -225,7 +225,7 @@ withRunnerGlobal go inner = do
useColor <- case colorWhen of
ColorNever -> pure False
ColorAlways -> pure True
ColorAuto -> hSupportsANSI stderr
ColorAuto -> hNowSupportsANSI stderr
termWidth <- clipWidth <$> maybe (fromMaybe defaultTerminalWidth
<$> getTerminalWidth)
pure go.globalTermWidth
Expand Down
2 changes: 2 additions & 0 deletions stack-ghc-9.8.1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
resolver: nightly-2024-01-06

extra-deps:
# nightly-2023-01-06 specifies ansi-terminal-1.0.
- ansi-terminal-1.0.2@sha256:1f90bb88e670ce63fbf2c9216d50857f2419582f1c6791e542c3eab97ecfd364,2897
# nightly-2023-01-06 specifies pantry-0.9.3.1@rev:0.
- pantry-0.9.3.1@sha256:79e9be1b28a9829cb9630ca97ac5732b0843ee8d60ce26b347ecd57740305c2b,7859
# nightly-2023-01-06 specifies tar-conduit-0.4.0
Expand Down
7 changes: 7 additions & 0 deletions stack-ghc-9.8.1.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
# https://docs.haskellstack.org/en/stable/lock_files

packages:
- completed:
hackage: ansi-terminal-1.0.2@sha256:1f90bb88e670ce63fbf2c9216d50857f2419582f1c6791e542c3eab97ecfd364,2897
pantry-tree:
sha256: d4405abe08cf99c47f2af8534346492a5679e17a19529667b3eeddad4c0f0149
size: 1184
original:
hackage: ansi-terminal-1.0.2@sha256:1f90bb88e670ce63fbf2c9216d50857f2419582f1c6791e542c3eab97ecfd364,2897
- completed:
hackage: pantry-0.9.3.1@sha256:79e9be1b28a9829cb9630ca97ac5732b0843ee8d60ce26b347ecd57740305c2b,7859
pantry-tree:
Expand Down
8 changes: 4 additions & 4 deletions stack.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ library
Cabal >=3.8.1.0
, aeson >=2.0.3.0
, aeson-warning-parser >=0.1.1
, ansi-terminal >=1.0
, ansi-terminal >=1.0.2
, array
, async
, attoparsec
Expand Down Expand Up @@ -470,7 +470,7 @@ executable stack
Cabal >=3.8.1.0
, aeson >=2.0.3.0
, aeson-warning-parser >=0.1.1
, ansi-terminal >=1.0
, ansi-terminal >=1.0.2
, array
, async
, attoparsec
Expand Down Expand Up @@ -571,7 +571,7 @@ executable stack-integration-test
Cabal >=3.8.1.0
, aeson >=2.0.3.0
, aeson-warning-parser >=0.1.1
, ansi-terminal >=1.0
, ansi-terminal >=1.0.2
, array
, async
, attoparsec
Expand Down Expand Up @@ -688,7 +688,7 @@ test-suite stack-unit-test
, QuickCheck
, aeson >=2.0.3.0
, aeson-warning-parser >=0.1.1
, ansi-terminal >=1.0
, ansi-terminal >=1.0.2
, array
, async
, attoparsec
Expand Down
2 changes: 2 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ extra-deps:
# Cabal is pruned because process is a GHC boot package, and has to be specified
# again.
- Cabal-3.10.1.0@sha256:6d11adf7847d9734e7b02785ff831b5a0d11536bfbcefd6634b2b08411c63c94,12316
# lts-22.0 specifies ansi-terminal-1.0
- ansi-terminal-1.0.2@sha256:1f90bb88e670ce63fbf2c9216d50857f2419582f1c6791e542c3eab97ecfd364,2897
# lts-22.0 specifies pantry-0.9.3.1@rev:0
- pantry-0.9.3.1@sha256:79e9be1b28a9829cb9630ca97ac5732b0843ee8d60ce26b347ecd57740305c2b,7859
# GHC 9.6.3 comes with process-1.6.17.0, which can segfault on macOS.
Expand Down
7 changes: 7 additions & 0 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ packages:
size: 9223
original:
hackage: Cabal-3.10.1.0@sha256:6d11adf7847d9734e7b02785ff831b5a0d11536bfbcefd6634b2b08411c63c94,12316
- completed:
hackage: ansi-terminal-1.0.2@sha256:1f90bb88e670ce63fbf2c9216d50857f2419582f1c6791e542c3eab97ecfd364,2897
pantry-tree:
sha256: d4405abe08cf99c47f2af8534346492a5679e17a19529667b3eeddad4c0f0149
size: 1184
original:
hackage: ansi-terminal-1.0.2@sha256:1f90bb88e670ce63fbf2c9216d50857f2419582f1c6791e542c3eab97ecfd364,2897
- completed:
hackage: pantry-0.9.3.1@sha256:79e9be1b28a9829cb9630ca97ac5732b0843ee8d60ce26b347ecd57740305c2b,7859
pantry-tree:
Expand Down
Loading