posix: make poll() restart on interruption by signal (
issue5452)
select() is a notable example of syscalls which may fail with EINTR. If we
had a SIGWINCH handler installed, ssh would crash when the terminal window
was resized. This patch fixes the problem.
--- a/mercurial/posix.py Mon Dec 19 22:46:00 2016 +0900
+++ b/mercurial/posix.py Thu Dec 22 23:14:13 2016 +0900
@@ -570,7 +570,14 @@
In unsupported cases, it will raise a NotImplementedError"""
try:
- res = select.select(fds, fds, fds)
+ while True:
+ try:
+ res = select.select(fds, fds, fds)
+ break
+ except select.error as inst:
+ if inst.args[0] == errno.EINTR:
+ continue
+ raise
except ValueError: # out of range file descriptor
raise NotImplementedError()
return sorted(list(set(sum(res, []))))