diff --git a/tests/integration/tests/4095-utf8-pure-nix/Main.hs b/tests/integration/tests/4095-utf8-pure-nix/Main.hs index 1edef46232..cbbb0dfc02 100644 --- a/tests/integration/tests/4095-utf8-pure-nix/Main.hs +++ b/tests/integration/tests/4095-utf8-pure-nix/Main.hs @@ -1,5 +1,9 @@ import StackTest +import Control.Monad ( unless ) +import Data.Maybe ( isJust ) +import System.Environment ( lookupEnv ) + -- This test requires that Nix is installed and that the NIX_PATH has been set -- so as to allow the path to be used. main :: IO () @@ -11,5 +15,11 @@ main logInfo "Disabled on macOS as it takes too long to run, since it tries \ \to build GHC." | otherwise = do - stack ["build", "--nix-pure"] - stack ["exec", "--nix-pure", "ShowUnicode"] + isInContainer <- getInContainer + unless isInContainer $ do + stack ["build", "--nix-pure"] + stack ["exec", "--nix-pure", "ShowUnicode"] + +-- | 'True' if we are currently running inside a Docker container. +getInContainer :: IO Bool +getInContainer = isJust <$> lookupEnv "STACK_IN_CONTAINER"