| Total Complexity | 2 |
| Total Lines | 15 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import fcntl, os |
||
| 2 | from sys import stdout, stderr |
||
| 3 | |||
| 4 | def to_blocking_mode(channel): |
||
| 5 | flags = fcntl.fcntl(channel, fcntl.F_GETFL) |
||
| 6 | if flags & os.O_NONBLOCK: |
||
| 7 | fcntl.fcntl(channel, fcntl.F_SETFL, flags & ~os.O_NONBLOCK) |
||
| 8 | return True |
||
| 9 | return False |
||
| 10 | |||
| 11 | if to_blocking_mode(stderr): |
||
| 12 | stderr.writelines(["Reset STDERR to blocking"]) |
||
| 13 | if to_blocking_mode(stdout): |
||
| 14 | stderr.writelines(["Reset STDOUT to blocking"]) |
||
| 15 |