I have an executable producing some output(stdout and stderr). I want to log it in a file and at the same display it in the terminal.
I’m using the following code:
my_executable 2>&1 | tee my_output.txt
It is working but the output is printed on the screen with a big delay compared in the case where I just run my_executable
without redirecting the output also to a file.
It seems tee has an internal queue and doesn’t send the output on the screen immediately.
How can I remove the delay? Are there alternative to tee that doesn’t add the delay?