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/1 

Notice strace works perfectly:

sudo strace -e write=1 -e trace=write -p 15608 

But 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?

1

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy