maralorn / nix-output-monitor

Pipe your nix-build output through the nix-output-monitor a.k.a nom to get additional information while building.
GNU Affero General Public License v3.0
907 stars 27 forks source link

Progress report breaks on juice SSH for Android (termux?) #75

Open NobbZ opened 1 year ago

NobbZ commented 1 year ago

The progress report breaks when displayed via JuiceSSH on an android phone.

JuiceSSH uses termux under the hood if I recall correctly.

Screenshot_20221203-103148

NobbZ commented 1 year ago

PS: when I start a tmux session and run nom within that, it works again.

maralorn commented 1 year ago

It looks like JuiceSSH does not support cursor movement control codes how other terminals do?

I don‘t know if I have the time and motivation to jump into that rabbit hole, but if someone can tell me how to fix this without breaking nom on other terminals I will try to fix this.

NobbZ commented 1 year ago

I'm not quite used to the haskell eco system, therefore a quick glance over any of your files, doesn't tell me anything about libraries used or their versions, but perhaps this is related to some library used?

Other TUI software or "rich UI" tools I use, work well on the terminal, so with a bit of luck, it is something we can just report to upstream and leave this open as a tracking ticket.

At least it feels weird that TERM=linux by default within such a SSH session. Though changing that to some "usually work" values like xterm or xterm-256color didn't change the behaviour.

Though what I realised during testing this:

The ticking clock during waiting for first input is updated properly, only once the graph has been drawn the first time, updating it fails. It then prints such an "artefact" every second.

maralorn commented 1 year ago

I’m doing this quite low-level. The library I use is: https://hackage.haskell.org/package/ansi-terminal-0.11.3. The version used is always the one provided by nixpkgs where you take nom from.

I just take the control codes from that library and write them to the output. I have honestly no clue if and how that library deals with the term variable at all.

NobbZ commented 1 year ago

I quickly skimmed the libraries code, and as all the "workhorse" functions are pure, I do not think it would even able to do special casing on the terminal type. Just some CPP "magic" to switch unix or windows implementation of the modules.

Thanks for the info. I will dig a bit deeper and see if this might be a bug in the terminal emulator interpeting some sequences wrong, or if I have configured it wrong or if the library emits some weird codes that are understood by 99% of the emulators but not termux…