Skip to content

Commit

Permalink
Merge d57a6d9 into 4507924
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpetrello committed May 21, 2018
2 parents 4507924 + d57a6d9 commit abfbe9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pexpect/utils.py
Expand Up @@ -165,7 +165,7 @@ def poll_ignore_interrupts(fds, timeout=None):

poller = select.poll()
for fd in fds:
poller.register(fd)
poller.register(fd, select.POLLIN | select.POLLPRI | select.POLLHUP | select.POLLERR)

while True:
try:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_misc.py
Expand Up @@ -87,6 +87,12 @@ def test_read_poll(self):
remaining = child.read().replace(_CAT_EOF, b'')
self.assertEqual(remaining, b'abc\r\n')

def test_read_poll_timeout(self):
" Test use_poll properly times out "
child = pexpect.spawn('sleep 5', use_poll=True)
with self.assertRaises(pexpect.TIMEOUT):
child.expect(pexpect.EOF, timeout=1)

def test_readline_bin_echo(self):
" Test spawn('echo'). "
# given,
Expand Down

0 comments on commit abfbe9b

Please sign in to comment.