Home | History | Annotate | Download | only in pexpect

Lines Matching refs:timeout

91 __all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'run', 'which',
137 class TIMEOUT(ExceptionPexpect):
139 """Raised when a read time exceeds the timeout. """
141 ##class TIMEOUT_PATTERN(TIMEOUT):
142 ## """Raised when the pattern match time exceeds the timeout.
143 ## This is different than a read TIMEOUT because the child process may
144 ## give output, thus never give a TIMEOUT, but the output
151 def run(command, timeout=-1, withexitstatus=False, events=None,
212 events={TIMEOUT:print_ticks}, timeout=5)
228 if timeout == -1:
231 child = spawn(command, timeout=timeout, maxread=2000, logfile=logfile,
237 # This assumes EOF or TIMEOUT will eventually cause run to terminate.
248 # child.after may have been a TIMEOUT or EOF,
263 except TIMEOUT as e:
282 def __init__(self, command, args=[], timeout=30, maxread=2000,
415 self.timeout = timeout
499 s.append('timeout: ' + str(self.timeout))
729 def waitnoecho(self, timeout=-1):
733 not set False before the timeout. This can be used to detect when the
743 If timeout==-1 then this method will use the value in self.timeout.
744 If timeout==None then this method to block until ECHO flag is False.
747 if timeout == -1:
748 timeout = self.timeout
749 if timeout is not None:
750 end_time = time.time() + timeout
754 if timeout < 0 and timeout is not None:
756 if timeout is not None:
757 timeout = end_time - time.time()
813 timeout=-1):
816 includes a timeout. If the read does not complete within the timeout
817 period then a TIMEOUT exception is raised. If the end of file is read
821 If timeout is None then the read may block indefinitely.
822 If timeout is -1 then the self.timeout value is used. If timeout is 0
824 then this will raise a TIMEOUT exception.
826 The timeout refers only to the amount of time to read at least one
828 read_nonblocking(size=100, timeout=30) and only one character is
833 implement the timeout. """
838 if timeout == -1:
839 timeout = self.timeout
843 # from the child_fd -- it will block forever or until TIMEOUT.
847 # timeout of 0 means "poll"
861 r, w, e = self.__select([self.child_fd], [], [], timeout)
866 # processes are alive; timeout on the select; and
871 raise TIMEOUT('Timeout exceeded.')
1222 # (unfortunately, this requires waiting through the timeout).
1259 Patterns must be a StringType, EOF, TIMEOUT, SRE_Pattern, or a list of
1261 might do this if waiting for an EOF or TIMEOUT condition without
1268 return self.expect_list(cpl, timeout)
1277 i = self.expect_list(clp, timeout)
1296 elif p is TIMEOUT:
1297 compiled_pattern_list.append(TIMEOUT)
1302 'EOF, TIMEOUT, SRE_Pattern, or a list of those ' +
1307 def expect(self, pattern, timeout=-1, searchwindowsize=-1):
1314 successful match. This may raise exceptions for EOF or TIMEOUT. To
1315 avoid the EOF or TIMEOUT exceptions add EOF or TIMEOUT to the pattern
1316 list. That will cause expect to match an EOF or TIMEOUT condition
1342 If timeout is -1 then timeout will be set to the self.timeout value.
1344 A list entry may be EOF or TIMEOUT instead of a string. This will
1350 index = p.expect(['good', 'bad', pexpect.EOF, pexpect.TIMEOUT])
1370 except TIMEOUT:
1386 timeout, searchwindowsize)
1388 def expect_list(self, pattern_list, timeout=-1, searchwindowsize=-1):
1392 also contain EOF or TIMEOUT(which are not compiled regular
1396 the expect() method. This is called by expect(). If timeout==-1 then
1397 the self.timeout value is used. If searchwindowsize==-1 then the
1401 timeout, searchwindowsize)
1403 def expect_exact(self, pattern_list, timeout=-1, searchwindowsize=-1):
1407 may be a string; a list or other sequence of strings; or TIMEOUT and
1418 pattern_list in (TIMEOUT, EOF)):
1421 timeout, searchwindowsize)
1423 def expect_loop(self, searcher, timeout=-1, searchwindowsize=-1):
1433 if timeout == -1:
1434 timeout = self.timeout
1435 if timeout is not None:
1436 end_time = time.time() + timeout
1454 if timeout < 0 and timeout is not None:
1455 raise TIMEOUT('Timeout exceeded in expect_any().')
1457 c = self.read_nonblocking(self.maxread, timeout)
1461 if timeout is not None:
1462 timeout = end_time - time.time()
1476 except TIMEOUT as e:
1479 self.after = TIMEOUT
1482 self.match = TIMEOUT
1488 raise TIMEOUT(str(e) + '\n' + str(self))
1622 def __select(self, iwtd, owtd, ewtd, timeout=None):
1631 if timeout is not None:
1632 end_time = time.time() + timeout
1635 return select.select(iwtd, owtd, ewtd, timeout)
1640 if timeout is not None:
1641 timeout = end_time - time.time()
1642 if timeout < 0:
1684 timeout_index - index of TIMEOUT, or -1
1698 may be a list; a sequence of strings; or the EOF or TIMEOUT types. """
1707 if s is TIMEOUT:
1723 ' %d: TIMEOUT' % self.timeout_index))
1784 timeout_index - index of TIMEOUT, or -1
1799 expressions, or the EOF or TIMEOUT types."""
1808 if s is TIMEOUT:
1824 ss.append((self.timeout_index, ' %d: TIMEOUT' %