Skip to content

command log output messed up and 0.58.0 regression (ANSI sgr0 as (B, missing newlines) #5188

@T3sT3ro

Description

@T3sT3ro

Describe the bug

Printing colored ANSI text terminated with reset sequence from a git hook prints (B to the command log in lazygit

Regression in 0.58.0: the command log also mangles the line breaks, making git hooks outptu unreadable in the log window

To Reproduce

To reproduce both the clobbered output and color issue:

  1. create new empty repository
  2. add the following pre-commit hook:
#!/bin/sh

echo "Testing progress bar:"
echo -ne '$#####                     (33%)\r'
sleep 1
echo -ne '#############             (66%)\r'
sleep 1
echo -ne '#######################   (100%)\r'
echo -ne '\n'

echo "this should work"
echo "$(tput setaf 1)This text is red$(tput sgr0)"
  1. Create a new commit and see the output in command log is clobbered (old screenshot without last echo with colored, but if you run it you will see):
Image
  1. Running the hook manually from terminal with .git/hooks/pre-commit prints expected:
./pre-commit
Testing progress bar:
#######################   (100%)
this should work

Expected behavior

Regular colored text should be printed and line endings displayed normally

Screenshots

weird rendering of tput sgr0 (formatting reset sequence):

Image

Below is regression in 0.58.0 when running pre-push hook containing uv run pipenv (it displays interactive progress bar)

command log from 0.57.0:

Image

Same output at 0.58.0:

Image

Version info:

  • commit=17d03ec8cb89d4c65fd129228164562a220abefb, build date=2025-12-06T13:01:50Z, build source=binaryRelease, version=0.57.0, os=linux, arch=amd64, git version=2.43.0
  • also on commit=a0e81c93b89ccb13efe186d057505c624fb1e4ec, build date=2026-01-03T19:26:24Z, build source=binaryRelease, version=0.58.0, os=linux, arch=amd64, git version=2.43.0
  • git version 2.43.0

Additional context

N/A

Note

Please try updating to the latest version or manually building the latest master to see if the issue still occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions