From fe9183cea2ae56a5c55e0f0bdde2fa60f35c2c93 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Tue, 26 Mar 2024 22:30:10 +0000 Subject: [PATCH] Re #6531 Fix 4095-utf8-pure-nix test when in Docker container --- tests/integration/tests/4095-utf8-pure-nix/Main.hs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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"