Bash function - command wrapper with logging needed

view story

https://bbs.archlinux.org – Pacman (or whatever underlying utility it uses) probably chooses not to draw progress bars when it detects that its stdout isn't a tty.  The only way I know of to do this is to create a pseudotty and execute your commands with that as their stdout, then read from the pty and redirect to the real stdout (and handle whatever logging functions you want).Notice, though, that the reasons apps like pacman are smart about what they write to stdout when it's not a tty is because things like progress bars involve a lot of escape codes to reposition the cursor and redraw character positio (HowTos)