How to replicate the dynamic stdout of a command?
I am working on a Raspberry Pi OS, and I make this Python script to run a command and capture it’s output. It works fine for commands that outputs text in a sequential way. But when I try to run commands that use dynamic updates, like apt-get update
that display a progres percentage, it fails to capture it. Dow you know how can I do to replicate the exact display behavior of the command, like it is shown in a real terminal window ? The thing is that I don’t realy use print(line.strip())
, instead I send the data over a network socket on another computer, and there I display it. On the other computer I know how to print the data in the virtual terminal windows, but what I don’t know is how can I read the control characters(?) and how I interpret them… ? I dont’ need it to work with complex programs with menus or other stuff, just simple commands like that shows some progress like apt-get update
does…
Is there a “2> dev null” style way to redirect *some* messages but not specific others?
Running Linux. I have a script I wrote that calls a local TTS engine called “Piper”. The script runs well and outputs two types of messages to the console – the info about the TTS process, and my text prompt. I do not need to display the TTS info, but I need the text prompt to display. In the output example below, the text prompt is “****>”