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 to 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 alternatives to tee
that don’t add the delay?
2