  
      def execute_script(self, command, args):
          """ Execute the requested Faceswap Script """
          logger.debug("Executing Faceswap: (command: '%s', args: %s)", command, args)
          self.thread = None
          self.command = command
          kwargs = {"stdout": PIPE,
                    "stderr": PIPE,
                    "bufsize": 1,
                    "universal_newlines": True}
  
          self.process = Popen(args, **kwargs, stdin=PIPE)
          self.thread_stdout()
          self.thread_stderr()
          logger.debug("Executed Faceswap")
  
      def _process_progress_stdout(self, output: str) -> bool:
          """ Process stdout for any faceswap processes that update the status/progress bar(s)
  
 
</s> remove     def execute_script(self, command, args):
        """ Execute the requested Faceswap Script """
 </s> add     @property
    def command(self) -> str | None:
        """ str | None: The currently executing command, when process running or ``None`` """
        return self._command

    def execute_script(self, command: str, args: list[str]) -> None:
        """ Execute the requested Faceswap Script

        Parameters
        ----------
        command: str
            The faceswap command that is to be run
        args: list[str]
            The full command line arguments to be executed
        """ </s> remove             _ = self.thread.get_result()  # Terminate the LongRunningTask object
            self.thread = None
 </s> add             _ = self._thread.get_result()  # Terminate the LongRunningTask object
            self._thread = None

    def _terminate_in_thread(self, command: str, process: Popen) -> bool:
        """ Terminate the subprocess </s> remove     """ Control the underlying Faceswap tasks """
    def __init__(self, wrapper):
        logger.debug("Initializing %s", self.__class__.__name__)
        self.wrapper = wrapper
 </s> add     """ Control the underlying Faceswap tasks.

    wrapper: :class:`ProcessWrapper`
        The object responsible for managing this faceswap task
    """
    def __init__(self, wrapper: ProcessWrapper) -> None:
        logger.debug("Initializing %s (wrapper: %s)", self.__class__.__name__, wrapper)
        self._wrapper = wrapper </s> remove     def __init__(self):
 </s> add     def __init__(self) -> None: </s> remove             self.command = command
            args = self.prepare(category)
            self.task.execute_script(command, args)
        self.tk_vars.action_command.set("")

    def generate_command(self, *args):
        """ Generate the command line arguments and output """
        if not self.tk_vars.generate_command.get():
 </s> add             self._command = command
            fs_args = self._prepare(T.cast(T.Literal["faceswap", "tools"], category))
            self._task.execute_script(command, fs_args)
        self._tk_vars.action_command.set("")

    def _generate_command(self,  # pylint:disable=unused-argument
                          *args: tuple[str, str, str]) -> None:
        """ Callback for when the Generate button is pressed. Process command line options and
        output the cli command

        Parameters
        ----------
        args:
            tuple[str, str, str]
                Tkinter variable callback args. Required but unused
        """
        if not self._tk_vars.generate_command.get():
        self._thread = None
        self._command = command

        proc = Popen(args,  # pylint:disable=consider-using-with
                     stdout=PIPE,
                     stderr=PIPE,
                     bufsize=1,
                     universal_newlines=True,
                     stdin=PIPE,
                     encoding="utf-8")
        self._process = proc
        self._thread_stdout()
        self._thread_stderr()
  
      def execute_script(self, command, args):
          """ Execute the requested Faceswap Script """
          logger.debug("Executing Faceswap: (command: '%s', args: %s)", command, args)
        self._thread = None
        self._command = command

        proc = Popen(args,  # pylint:disable=consider-using-with
                     stdout=PIPE,
                     stderr=PIPE,
                     bufsize=1,
                     universal_newlines=True,
                     stdin=PIPE,
                     encoding="utf-8")
        self._process = proc
        self._thread_stdout()
        self._thread_stderr()
        self._thread = None
        self._command = command

        proc = Popen(args,  # pylint:disable=consider-using-with
                     stdout=PIPE,
                     stderr=PIPE,
                     bufsize=1,
                     universal_newlines=True,
                     stdin=PIPE,
                     encoding="utf-8")
        self._process = proc
        self._thread_stdout()
        self._thread_stderr()
        self._thread = None
        self._command = command

        proc = Popen(args,  # pylint:disable=consider-using-with
                     stdout=PIPE,
                     stderr=PIPE,
                     bufsize=1,
                     universal_newlines=True,
                     stdin=PIPE,
                     encoding="utf-8")
        self._process = proc
        self._thread_stdout()
        self._thread_stderr()
        self._thread = None
        self._command = command

        proc = Popen(args,  # pylint:disable=consider-using-with
                     stdout=PIPE,
                     stderr=PIPE,
                     bufsize=1,
                     universal_newlines=True,
                     stdin=PIPE,
                     encoding="utf-8")
        self._process = proc
        self._thread_stdout()
        self._thread_stderr()
        self._thread = None
        self._command = command

        proc = Popen(args,  # pylint:disable=consider-using-with
                     stdout=PIPE,
                     stderr=PIPE,
                     bufsize=1,
                     universal_newlines=True,
                     stdin=PIPE,
                     encoding="utf-8")
        self._process = proc
        self._thread_stdout()
        self._thread_stderr()
        self._thread = None
        self._command = command

        proc = Popen(args,  # pylint:disable=consider-using-with
                     stdout=PIPE,
                     stderr=PIPE,
                     bufsize=1,
                     universal_newlines=True,
                     stdin=PIPE,
                     encoding="utf-8")
        self._process = proc
        self._thread_stdout()
        self._thread_stderr()
        self._thread = None
        self._command = command

        proc = Popen(args,  # pylint:disable=consider-using-with
                     stdout=PIPE,
                     stderr=PIPE,
                     bufsize=1,
                     universal_newlines=True,
                     stdin=PIPE,
                     encoding="utf-8")
        self._process = proc
        self._thread_stdout()
        self._thread_stderr()
        self._thread = None
        self._command = command

        proc = Popen(args,  # pylint:disable=consider-using-with
                     stdout=PIPE,
                     stderr=PIPE,
                     bufsize=1,
                     universal_newlines=True,
                     stdin=PIPE,
                     encoding="utf-8")
        self._process = proc
        self._thread_stdout()
        self._thread_stderr()
        self._thread = None
        self._command = command

        proc = Popen(args,  # pylint:disable=consider-using-with
                     stdout=PIPE,
                     stderr=PIPE,
                     bufsize=1,
                     universal_newlines=True,
                     stdin=PIPE,
                     encoding="utf-8")
        self._process = proc
        self._thread_stdout()
        self._thread_stderr()
        self._thread = None
        self._command = command

        proc = Popen(args,  # pylint:disable=consider-using-with
                     stdout=PIPE,
                     stderr=PIPE,
                     bufsize=1,
                     universal_newlines=True,
                     stdin=PIPE,
                     encoding="utf-8")
        self._process = proc
        self._thread_stdout()
        self._thread_stderr()
          logger.debug("Executed Faceswap")
  
      def _process_progress_stdout(self, output: str) -> bool:
          """ Process stdout for any faceswap processes that update the status/progress bar(s)
  
keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 bugfix: GUI force stdout/stderr reading to utf-8 
lib/gui/wrapper.py