class_docstr: This is the main class interface for Pexpect. Use this class to start
  and control child applications. 
class_docstr_tok: ["This","is","the","main","class","interface","for","Pexpect",".","Use","this","class","to","start","and","control","child","applications","."]
docstr: This forces a child process to terminate. It starts nicely with
  SIGHUP and SIGINT. If "force" is True then moves onto SIGKILL. This
  returns True if the child was terminated. This returns False if the
  child could not be terminated. 
docstr_tok: ["This","forces","a","child","process","to","terminate",".","It","starts","nicely","with","SIGHUP","and","SIGINT",".","If","``","force","''","is","True","then","moves","onto","SIGKILL",".","This","returns","True","if","the","child","was","terminated",".","This","returns","False","if","the","child","could","not","be","terminated","."]
code: def terminate(self, force=False):
      """This forces a child process to terminate. It starts nicely with
      SIGHUP and SIGINT. If "force" is True then moves onto SIGKILL. This
      returns True if the child was terminated. This returns False if the
      child could not be terminated."""
  
      if not self.isalive():
          return True
      try:
          self.kill(signal.SIGHUP)
          time.sleep(self.delayafterterminate)
          if not self.isalive():
              return True
          self.kill(signal.SIGCONT)
          time.sleep(self.delayafterterminate)
          if not self.isalive():
              return True
          self.kill(signal.SIGINT)
          time.sleep(self.delayafterterminate)
          if not self.isalive():
              return True
          if force:
              self.kill(signal.SIGKILL)
              time.sleep(self.delayafterterminate)
              if not self.isalive():
                  return True
              else:
                  return False
          return False
      except OSError:
          # I think there are kernel timing issues that sometimes cause
          # this to happen. I think isalive() reports True, but the
          # process is dead to the kernel.
          # Make one last attempt to see if the kernel is up to date.
          time.sleep(self.delayafterterminate)
          if not self.isalive():
              return True
          else:
              return False
  
imports: import os
  import sys
  import time
  import pty
  import tty
  import errno
  import signal
  from contextlib import contextmanager
  import ptyprocess
  from ptyprocess.ptyprocess import use_native_pty_fork
  from .exceptions import ExceptionPexpect, EOF, TIMEOUT
  from .spawnbase import SpawnBase
  from .utils import which, split_command_line, select_ignore_interrupts, poll_ignore_interrupts
label_desc: Use image node_id 22 for calling the spawn obj's underlying member method code with example usage: obj.terminate(force) and returns: True, False, True, True, True, True, False, True, False