multitail icon indicating copy to clipboard operation
multitail copied to clipboard

Handling overwritten progress lines in 'multitail -l ...'

Open BMJ-pdx opened this issue 3 years ago • 3 comments

One thing multitail doesn't seem to handle is command output (for monitoring by '-l ...') that includes overwritten progress or status line(s). Some programs that produce such output are wget, curl, yt-dlp, youtube-dl, ffmpeg, 'fsck -C' (in a GNU/Linux context). In some cases the overwriting is done by escape sequences; I suppose by a simple ^M (carriage return) in some cases also. The problem would seem to be that the reads from the external command are buffered up (perhaps until newline is seen) and don't get to the display in the proverbial timely fashion. I've just started looking into the multitail source. If someone can fast-track me on how the reads are done, and whether it seems feasible to support this kind of overwriting, that would of course help. Thanks -- -- Bruce Jerrick P.S.: It just occurred to me that it could also be ncurses that's doing the unwanted buffering. P.P.S: To avoid possible confusion: When I use the term "buffer" above, I am referring to I/O buffering, not multitail's scrollback buffering.

BMJ-pdx avatar Jun 08 '22 17:06 BMJ-pdx

I have found that statistics.bytes_processed doesn't change while the external command is updating its progress report. So I suspect that the pty is in line-buffered mode (although that can't be the case when the command is run standalone, since its progress line does get updated then. Unless it does explicit flushes, but then multitail should see them too). (My test case has been 'yt-dlp', mainly because the command can be short enough to avoid hosing multitail's status line. I'm going to switch to something simpler, if I can find a short-enough URL for wget or curl :-) .)

BMJ-pdx avatar Jun 08 '22 21:06 BMJ-pdx

Here's a simple test case, although it doesn't test how escape sequences are handled. It can be run with 'multitail -l test-overwrite' (compare to being run standalone). The ^M (\r) seem to disappear completely.

(Sorry, but the indentation gets hosed.)

#!/bin/sh -u # Produce overwrites with ^M, to test 'multitail'. n=0 while : ; do printf "%s\r" "$(date)" sleep 1 # Newline every five iterations: (( ++n % 5 == 0 )) && echo done

BMJ-pdx avatar Jun 08 '22 22:06 BMJ-pdx

@BMJ-pdx: Sorry for this place but your ticket is solved or not? 300: "Minor formatting goofs in ksmbd.conf.example"

I have not your email address to talk easily... Thanks in advance.

Neustradamus avatar Aug 04 '23 03:08 Neustradamus