diff options
| -rwxr-xr-x | Omni/Ci.hs | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -60,6 +60,7 @@ move args = do currentBildArgs <- Environment.lookupEnv "BILD_ARGS" let bildArgs = "--time 0 " <> fromMaybe "" currentBildArgs Environment.setEnv "BILD_ARGS" bildArgs + Log.info ["ci", "set BILD_ARGS=" <> Text.pack bildArgs] -- 3. Get user info at <- readProcess "date" ["-u", "-R"] "" |> fmap chomp @@ -146,7 +147,7 @@ move args = do -- We can pass namespaces. -- Let's try passing all files again. -- bild handles namespaces. - (exitCodeTest, _, testStderr) <- Process.readProcessWithExitCode "bild" ("--test" : allFiles) "" + (exitCodeTest, _, testStderr) <- Process.readProcessWithExitCode "bild" ("--test" : "--time" : "0" : allFiles) "" pure <| case exitCodeTest of Exit.ExitSuccess -> ("good", "") _ -> ("fail", extractErrorMessage (Text.pack testStderr)) @@ -209,6 +210,7 @@ extractErrorMessage :: Text -> Text extractErrorMessage output = let errorLines = Text.lines output + |> map stripAnsiEscapes -- Remove ANSI escape sequences |> filter isErrorLine |> take 5 -- Limit to first 5 error lines cleaned = @@ -230,3 +232,10 @@ extractErrorMessage output = `Text.isInfixOf` stripped ) && not ("warning:" `Text.isInfixOf` stripped) -- Exclude warnings + + -- Remove ANSI escape sequences including carriage returns + stripAnsiEscapes line = + line + |> Text.replace "\r" "" -- Remove carriage returns + |> Text.replace "\ESC[" "" -- Remove ANSI escape start + |> Text.filter (\c -> c >= ' ' || c == '\t') -- Keep only printable chars and tabs |
