I am trying to redirect the output of certain program with threads to certain file.
I have tried running command > file 2&>1 but if command has not stopped running, file will still be empty.
Is there any way to asynchronously dump the output to file?
Example python snippet:
import _thread
def run():
raise ValueError('plah')
_thread.start_new_thread(run, ())
while True:
pass
Running python program.py 2> log.txt does not yield an output in log.txt until the program is manually stopped.