class_docstr: This class represents a process running in a pseudoterminal.
  
  The main constructor is the :meth:`spawn` classmethod.
docstr: 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. 
docstr_tok: ["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","."]
code: def isalive(self):
      """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."""
  
      if self.terminated:
          return False
  
      if self.flag_eof:
          # This is for Linux, which requires the blocking form
          # of waitpid to get the status of a defunct process.
          # This is super-lame. The flag_eof would have been set
          # in read_nonblocking(), so this should be safe.
          waitpid_options = 0
      else:
          waitpid_options = os.WNOHANG
  
      try:
          pid, status = os.waitpid(self.pid, waitpid_options)
      except OSError as e:
          # No child processes
          if e.errno == errno.ECHILD:
              raise PtyProcessError(
                  "isalive() encountered condition "
                  + 'where "terminated" is 0, but there was no child '
                  + "process. Did someone else call waitpid() "
                  + "on our process?"
              )
          else:
              raise
  
      # I have to do this twice for Solaris.
      # I can't even believe that I figured this out...
      # If waitpid() returns 0 it means that no child process
      # wishes to report, and the value of status is undefined.
      if pid == 0:
          try:
              ### os.WNOHANG) # Solaris!
              pid, status = os.waitpid(self.pid, waitpid_options)
          except OSError as e:  # pragma: no cover
              # This should never happen...
              if e.errno == errno.ECHILD:
                  raise PtyProcessError(
                      "isalive() encountered condition "
                      + "that should never happen. There was no child "
                      + "process. Did someone else call waitpid() "
                      + "on our process?"
                  )
              else:
                  raise
  
          # If pid is still 0 after two calls to waitpid() then the process
          # really is alive. This seems to work on all platforms, except for
          # Irix which seems to require a blocking call on waitpid or select,
          # so I let read_nonblocking take care of this situation
          # (unfortunately, this requires waiting through the timeout).
          if pid == 0:
              return True
  
      if pid == 0:
          return True
  
      if os.WIFEXITED(status):
          self.status = status
          self.exitstatus = os.WEXITSTATUS(status)
          self.signalstatus = None
          self.terminated = True
      elif os.WIFSIGNALED(status):
          self.status = status
          self.exitstatus = None
          self.signalstatus = os.WTERMSIG(status)
          self.terminated = True
      elif os.WIFSTOPPED(status):
          raise PtyProcessError(
              "isalive() encountered condition "
              + "where child process is stopped. This is not "
              + "supported. Is some other process attempting "
              + "job control with our child pid?"
          )
      return False
  
imports: import codecs
  import errno
  import fcntl
  import io
  import os
  import pty
  import resource
  import signal
  import struct
  import sys
  import termios
  import time
  from pty import STDIN_FILENO, CHILD
  from .util import which, PtyProcessError
label_desc: Use image node_id 24 for calling the PtyProcess obj's underlying member method code with example usage: obj.isalive() and returns: False, False, True, True