diff options
author | Cooper Ry Lees <me@cooperlees.com> | 2018-04-13 09:43:30 -0700 |
---|---|---|
committer | Cooper Ry Lees <me@cooperlees.com> | 2018-04-13 09:43:30 -0700 |
commit | caad4403a5f433e50ad0aeb5f32e5d5c48d0594d (patch) | |
tree | 647825501ccc44b582408460ece1f28f3bbe0888 /pexpect/pty_spawn.py | |
parent | 70027ab5b40f3d74c58b05779e55511d3ae16ef6 (diff) | |
download | pexpect-git-caad4403a5f433e50ad0aeb5f32e5d5c48d0594d.tar.gz |
Make poll_ignore_interrupts register multiple FDs like select.select call and fix broken __interact_copy implementation
Diffstat (limited to 'pexpect/pty_spawn.py')
-rw-r--r-- | pexpect/pty_spawn.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pexpect/pty_spawn.py b/pexpect/pty_spawn.py index bb36f7d..e0e2b54 100644 --- a/pexpect/pty_spawn.py +++ b/pexpect/pty_spawn.py @@ -447,7 +447,7 @@ class spawn(SpawnBase): if not self.isalive(): # timeout of 0 means "poll" if self.use_poll: - r = poll_ignore_interrupts(self.child_fd, timeout) + r = poll_ignore_interrupts([self.child_fd], timeout) else: r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0) if not r: @@ -458,14 +458,14 @@ class spawn(SpawnBase): # FIXME So does this mean Irix systems are forced to always have # FIXME a 2 second delay when calling read_nonblocking? That sucks. if self.use_poll: - r = poll_ignore_interrupts(self.child_fd, timeout) + r = poll_ignore_interrupts([self.child_fd], timeout) else: r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2) if not r and not self.isalive(): self.flag_eof = True raise EOF('End Of File (EOF). Slow platform.') if self.use_poll: - r = poll_ignore_interrupts(self.child_fd, timeout) + r = poll_ignore_interrupts([self.child_fd], timeout) else: r, w, e = select_ignore_interrupts( [self.child_fd], [], [], timeout @@ -781,15 +781,16 @@ class spawn(SpawnBase): return os.read(fd, 1000) - def __interact_copy(self, escape_character=None, - input_filter=None, output_filter=None): + def __interact_copy( + self, escape_character=None, input_filter=None, output_filter=None + ): '''This is used by the interact() method. ''' while self.isalive(): if self.use_poll: - r = poll_ignore_interrupts(self.child_fd) + r = poll_ignore_interrupts([self.child_fd, self.STDIN_FILENO]) else: r, w, e = select_ignore_interrupts( [self.child_fd, self.STDIN_FILENO], [], [] |