MCPcopy Create free account
hub / github.com/pexpect/pexpect / wait

Method wait

pexpect/pty_spawn.py:672–694  ·  view source on GitHub ↗

This waits until the child exits. This is a blocking call. This will not read any data from the child, so this will block forever if the child has unread output and has terminated. In other words, the child may have printed output then called exit(), but, the child is

(self)

Source from the content-addressed store, hash-verified

670 return False
671
672 def wait(self):
673 '''This waits until the child exits. This is a blocking call. This will
674 not read any data from the child, so this will block forever if the
675 child has unread output and has terminated. In other words, the child
676 may have printed output then called exit(), but, the child is
677 technically still alive until its output is read by the parent.
678
679 This method is non-blocking if :meth:`wait` has already been called
680 previously or :meth:`isalive` method returns False. It simply returns
681 the previously determined exit status.
682 '''
683
684 ptyproc = self.ptyproc
685 with _wrap_ptyprocess_err():
686 # exception may occur if "Is some other process attempting
687 # "job control with our child pid?"
688 exitstatus = ptyproc.wait()
689 self.status = ptyproc.status
690 self.exitstatus = ptyproc.exitstatus
691 self.signalstatus = ptyproc.signalstatus
692 self.terminated = True
693
694 return exitstatus
695
696 def isalive(self):
697 '''This tests if the child process is running or not. This is

Callers

nothing calls this directly

Calls 1

_wrap_ptyprocess_errFunction · 0.85

Tested by

no test coverage detected