diff options
author | tv <tv@krebsco.de> | 2023-02-02 14:47:10 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2023-02-02 15:25:55 +0100 |
commit | 9316f445b62fbe9f92f8bf41c8c3780cd323839b (patch) | |
tree | f4365d9d69128cd0bca2e9d7d8d11920ec2ab12a /krebs | |
parent | 7f45ab5b685cf2769bb07077568d5bdabab22824 (diff) |
nixos-format-error: grok SGR and \r
Diffstat (limited to 'krebs')
-rw-r--r-- | krebs/5pkgs/simple/nixos-format-error.nix | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/krebs/5pkgs/simple/nixos-format-error.nix b/krebs/5pkgs/simple/nixos-format-error.nix index 9ba410bbe..a28f7245f 100644 --- a/krebs/5pkgs/simple/nixos-format-error.nix +++ b/krebs/5pkgs/simple/nixos-format-error.nix @@ -30,14 +30,14 @@ pkgs.writeGawkBin "nixos-format-error" '' } state == IDLE { - if ($0 == "building the system configuration...") { + if ($0 ~ /^building the system configuration\.\.\.
?$/) { state = ACTIVE } out() } state == ACTIVE { - if ($1 == "error:") { + if ($1 ~ /(\[[0-9;]+m)?error:(\[[0-9;]m)?/) { state = ERROR sub(/^/,"\x1b[31;1m"); sub(/$/,"\x1b[m") trace[trace_count++] = $0 @@ -57,6 +57,8 @@ pkgs.writeGawkBin "nixos-format-error" '' } state == ERROR { + sub(/
$/, "") + gsub(/\[[0-9;]*m/, "") if ($0 ~ /^\s*at /) { location = gensub(/^\s*at (.*):$/,"\\1","1") |