summaryrefslogtreecommitdiff
path: root/Omni
diff options
context:
space:
mode:
Diffstat (limited to 'Omni')
-rw-r--r--Omni/Bild.nix1
-rw-r--r--Omni/Log/Concurrent.hs7
-rw-r--r--Omni/Log/Terminal.hs16
3 files changed, 16 insertions, 8 deletions
diff --git a/Omni/Bild.nix b/Omni/Bild.nix
index f6291ef..aae82db 100644
--- a/Omni/Bild.nix
+++ b/Omni/Bild.nix
@@ -229,6 +229,7 @@
+ self.lib.strings.removePrefix (toString src) (toString target);
buildPhase = ''
export CODEROOT=$(pwd)
+ export NO_COLOR=1
mkdir $out
${self.bild}/bin/bild --plan "$TARGET" 1> $out/analysis.json \
2> >(tee -a $out/stderr >&2)
diff --git a/Omni/Log/Concurrent.hs b/Omni/Log/Concurrent.hs
index 83289f3..edf87fd 100644
--- a/Omni/Log/Concurrent.hs
+++ b/Omni/Log/Concurrent.hs
@@ -79,9 +79,10 @@ withLineManager nss action = do
-- | Initialize all lines with pending status
initializeLines :: LineManager -> IO ()
initializeLines LineManager {..} =
- case tiMode lmTermInfo of
- SingleLine -> pure () -- No initialization needed
- MultiLine -> do
+ case (tiMode lmTermInfo, tiSupportsANSI lmTermInfo) of
+ (_, False) -> pure () -- No ANSI support, skip initialization
+ (SingleLine, _) -> pure () -- No initialization needed
+ (MultiLine, _) -> do
nsMap <- readIORef namespaceLines
forM_ (Map.toList nsMap) <| \(ns, _) -> do
ANSI.hSetCursorColumn IO.stderr 0
diff --git a/Omni/Log/Terminal.hs b/Omni/Log/Terminal.hs
index a78e544..0d2ca7a 100644
--- a/Omni/Log/Terminal.hs
+++ b/Omni/Log/Terminal.hs
@@ -33,16 +33,22 @@ detectTerminal :: IO TerminalInfo
detectTerminal = do
term <- Env.lookupEnv "TERM"
area <- Env.lookupEnv "AREA"
+ noColor <- Env.lookupEnv "NO_COLOR"
-- Check if we support ANSI
- let supportsANSI = case (term, area) of
- (Just "dumb", _) -> False
- (_, Just "Live") -> False -- production logs
- (Nothing, _) -> False
+ let supportsANSI = case (term, area, noColor) of
+ (_, _, Just _) -> False -- NO_COLOR set
+ (Just "dumb", _, _) -> False
+ (_, Just "Live", _) -> False -- production logs
+ (Nothing, _, _) -> False
_ -> True
-- Get terminal size, catching exceptions from stdin issues
- mSize <- Exception.catch ANSI.getTerminalSize <| \(_ :: Exception.IOException) -> pure Nothing
+ -- When NO_COLOR is set or ANSI is not supported, skip terminal size detection
+ -- to avoid outputting escape codes
+ mSize <- case supportsANSI of
+ False -> pure Nothing -- Skip if no ANSI support
+ True -> Exception.catch ANSI.getTerminalSize <| \(_ :: Exception.IOException) -> pure Nothing
let (width, height) = case mSize of
Just (h, w) -> (w, h)
Nothing -> (80, 24) -- sensible default