> What you could do is to patch a terminal to allow programs to because
> paused via SIGSTOP when invisible and continued via SIGCONT when
> visible. Then your program would only need to write some string to
> the terminal when it starts and when it terminates. Multiplexers
> could however become an issue, but you could patch one as well.
Sending SIGSTOP stops even the programs that simply do something in the
background, like software update. This will make it impossible to run
something like "apt-get upgrade" in invisible terminal.
Maybe a better solution is to send XOFF (see
https://en.wikipedia.org/wiki/Software_flow_control), but I am also not
sure how other programs react to it. They will probably block waiting
for the write(2) syscall to return instead of continuing to do work in
the background.
If they use separate threads/coroutines for the work and for progress
bar update, they will continue to work while progress bar will be
blocked. Once unlocked, they will send the rest of previous progress bar
update, skip all the "frames" that were never displayed and display the
final state.
Looks like doing an XOFF patch for st and fixing all the programs that
can't handle it properly is the "right thing", but prepare to discover
that badly written programs will stop or even timeout with an error.
Received on Mon Sep 07 2020 - 09:13:26 CEST