I have a simple example of writing to stdout:
import datetime
import time
if __name__ == '__main__': while True: print('time is {}'.format(datetime.datetime.now().time())) time.sleep(5)Then I did:
python main.py & echo $!to run my process and get its PID.
My purpose is reading from stdout of my current process above, but all of these commands just freeze console and don't show stdout content
sudo tail -f /proc/15608/fd/1my console
sudo cat /proc/15608/fd/1Notice strace works perfectly:
sudo strace -e write=1 -e trace=write -p 15608But it gives me too much useless text.
My question: why don't cat (and tail) work properly and freeze my console? Could somebody explain me why it happens?