def isalive(self):
if self.terminated:<EOL><INDENT>return False<EOL><DEDENT>if self.flag_eof:<EOL><INDENT>waitpid_options = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>waitpid_options = os.WNOHANG<EOL><DEDENT>try:<EOL><INDENT>pid, status = os.waitpid(self.pid, waitpid_options)<EOL><DEDENT>except OSError as e: <EOL><INDENT>if e.errno == errno.ECHILD:<EOL><INDENT>raise ExceptionPexpect ('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>raise e<EOL><DEDENT><DEDENT>if pid == <NUM_LIT:0>:<EOL><INDENT>try:<EOL><INDENT>pid, status = os.waitpid(self.pid, waitpid_options) <EOL><DEDENT>except OSError as e: <EOL><INDENT>if e[<NUM_LIT:0>] == errno.ECHILD:<EOL><INDENT>raise ExceptionPexpect ('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>raise e<EOL><DEDENT><DEDENT>if pid == <NUM_LIT:0>:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>if pid == <NUM_LIT:0>:<EOL><INDENT>return True<EOL><DEDENT>if os.WIFEXITED (status):<EOL><INDENT>self.status = status<EOL>self.exitstatus = os.WEXITSTATUS(status)<EOL>self.signalstatus = None<EOL>self.terminated = True<EOL><DEDENT>elif os.WIFSIGNALED (status):<EOL><INDENT>self.status = status<EOL>self.exitstatus = None<EOL>self.signalstatus = os.WTERMSIG(status)<EOL>self.terminated = True<EOL><DEDENT>elif os.WIFSTOPPED (status):<EOL><INDENT>raise ExceptionPexpect ('<STR_LIT>')<EOL><DEDENT>return False<EOL>
This tests if the child process is running or not. This is
        non-blocking. If the child was terminated then this will read the
        exitstatus or signalstatus of the child. This returns True if the child
        process appears to be running or False if not. It can take literally
        SECONDS for Solaris to return the right status.