I'm trying to read from an open os.pipe()
to see if it's empty at the moment of the reading. The problem is that calling read()
causes the program to block there until there is actually something to read there however there won't be any, if the test I'm doing succeeded.
I know I can use select.select()
with a timeout however I wanted to know if there is another solution to the problem.
You might try this.
With this
thePipe.read()
should be non-blocking.From pipe(7) man page: