def bug1():
# BUG:
# sys.stdin.readline() in `ask` dies with IOError and
# errno=EINTR when the terminal gets resized after curses has
# been de-initialized.
# 1: SIGWINCH is sent by the terminal when the screen has been
# resized.
# 2: curses forgot to restore the signal handling of SIGWINCH
# to the default of ignoring the signal.
# NOTE: signal.getsignal(signal.SIGWINCH) incorrectly
# returns signal.SIG_DFL. (Default is to be ignored.)
# 3: Python fails to handle EINTR when reading from stdin.
# REFERENCES:
# Issue 3949: https://bugs.python.org/issue3949
# PEP 0457: https://www.python.org/dev/peps/pep-0475/
def handler(foo, bar):
print("Resized")
signal.signal(signal.SIGWINCH, handler)
while True:
sys.stdin.readline()
评论列表
文章目录