code: def terminate(self):
          
          if self._process.state() == QProcess.Running:
              try:
                  self._process.terminate()
              except Exception:
                  pass
          self._fired = True
docs: Terminate running processes.