Blame SOURCES/python-urwid-test_vterm-EINTR.patch
|
|
d88811 |
commit f68f2cf089cfd5ec45863baf59a91d5aeb0cf5c3
|
|
|
d88811 |
Author: Mike Gilbert <floppym@gentoo.org>
|
|
|
d88811 |
Date: Sat Jun 3 14:53:51 2017 -0400
|
|
|
d88811 |
|
|
|
d88811 |
test_vterm: handle EINTR when reading from pipe
|
|
|
d88811 |
|
|
|
d88811 |
Fixes: https://github.com/urwid/urwid/issues/230
|
|
|
d88811 |
|
|
|
d88811 |
diff --git a/urwid/tests/test_vterm.py b/urwid/tests/test_vterm.py
|
|
|
d88811 |
index 4dadfcc..075c653 100644
|
|
|
d88811 |
--- a/urwid/tests/test_vterm.py
|
|
|
d88811 |
+++ b/urwid/tests/test_vterm.py
|
|
|
d88811 |
@@ -18,6 +18,7 @@
|
|
|
d88811 |
#
|
|
|
d88811 |
# Urwid web site: http://excess.org/urwid/
|
|
|
d88811 |
|
|
|
d88811 |
+import errno
|
|
|
d88811 |
import os
|
|
|
d88811 |
import sys
|
|
|
d88811 |
import unittest
|
|
|
d88811 |
@@ -28,7 +29,6 @@ from urwid import vterm
|
|
|
d88811 |
from urwid import signals
|
|
|
d88811 |
from urwid.compat import B
|
|
|
d88811 |
|
|
|
d88811 |
-
|
|
|
d88811 |
class DummyCommand(object):
|
|
|
d88811 |
QUITSTRING = B('|||quit|||')
|
|
|
d88811 |
|
|
|
d88811 |
@@ -41,12 +41,20 @@ class DummyCommand(object):
|
|
|
d88811 |
stdout.write(B('\x1bc'))
|
|
|
d88811 |
|
|
|
d88811 |
while True:
|
|
|
d88811 |
- data = os.read(self.reader, 1024)
|
|
|
d88811 |
+ data = self.read(1024)
|
|
|
d88811 |
if self.QUITSTRING == data:
|
|
|
d88811 |
break
|
|
|
d88811 |
stdout.write(data)
|
|
|
d88811 |
stdout.flush()
|
|
|
d88811 |
|
|
|
d88811 |
+ def read(self, size):
|
|
|
d88811 |
+ while True:
|
|
|
d88811 |
+ try:
|
|
|
d88811 |
+ return os.read(self.reader, size)
|
|
|
d88811 |
+ except OSError as e:
|
|
|
d88811 |
+ if e.errno != errno.EINTR:
|
|
|
d88811 |
+ raise
|
|
|
d88811 |
+
|
|
|
d88811 |
def write(self, data):
|
|
|
d88811 |
os.write(self.writer, data)
|