How to show realtime output of a command

Hello, i am running a Linux bash script command through golang.
I want to show real-time output of that command, how can i do that?
for example,
I am running yum -y update through golang, i want to show it’s real-time output to the user.
Actually, i am making an software which runs in command line. So i want to show real-time output of a bash script to the user.
Please tell me how can i do this, i read many forums but didn’t understood.
all are giving an complicated explanation.

Let’s assume , i want to run :
curl -Lso- bench.sh | bash
This command through golang, how can i run and how can i show the real time output to the user

This isn’t a definitive answer, but I think that this actually is complicated to do based on what I’m finding after some Googling about stdin/stdout buffering. I guess writing to a pipe is fundamentally different than writing to a terminal. You might have some luck if you look for a utility called stdbuf.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.