code: def process_script(self, filename):
          
          try:
              with managed_process(subprocess.Popen(shlex.split("bash %s" % filename),
                                                    stdout=self.stdout, stderr=self.stderr,
                                                    shell=self.shell, env=self.env)) as process:  # nosec
                  for line in iter(process.stdout.readline, ' '):
                      if not line:
                          break
                      yield line[0:-1].decode('utf-8')
                  process.wait()
                  self.exit_code = process.returncode
                  self.success = (process.returncode == 0)
                  if not self.config.internal:
                      if process.returncode == 0:
                          self.logger.info("Exit code has been %d", process.returncode)
                      else:
                          self.logger.error("Exit code has been %d", process.returncode)
          except OSError as exception:
              self.exit_code = 1
              self.success = False
              yield str(exception)
docs: Running the Bash code.