jesseduffield / lazydocker

The lazier way to manage everything docker
MIT License
37.22k stars 1.19k forks source link

Escape sequences printed in logs #235

Open probablykasper opened 4 years ago

probablykasper commented 4 years ago

Sometimes, escape sequences are printed in lazydocker. I'm not sure exactly which escape sequences this happens for, but as you can see below it does happens for [2;K[1;G. [2;K seems to be for erasing the current line.

This log is from running yarn install inside a node image with tty: true:

[2;K[1;Gyarn install v1.22.5
[2;K[1;Gwarning package-lock.json found. Your project contains lock
[2;K[1;G[1/4] Resolving packages...
[1;G[0;K[2;K[1;G[2;K[1;Gsuccess Already up-to-date.
[2;K[1;GDone in 0.36s.

When running docker-compose logs, this is the output:

yarn install v1.22.5
warning package-lock.json found. Your project contains lock
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.36s.

In addition to yarn, I've noticed it happening in parcel bundler.

To Reproduce

Steps to reproduce the behavior:

  1. Create a node docker-compose service with tty: true
  2. Make sure the container runs yarn install

Desktop

probablykasper commented 4 years ago

@jesseduffield Any idea what would need to be done to fix this?

jesseduffield commented 2 years ago

Sorry for the very belated response @probablykasper . the [2;K form should be properly parsed now, but the [1;G form isn't implemented. This is all handled in vendor/github.com/jesseduffield/gocui/escape.go in the parseOne function. Happy to give guidance to anybody who wants to work on this