  """ Process wrapper for underlying faceswap commands for the GUI """
  import os
  import re
  import signal
  from subprocess import PIPE, Popen
  import sys
  import tkinter as tk
  from threading import Thread
  from time import time
  
 
</s> remove         self.process = Popen(args, **kwargs)
 </s> add         self.process = Popen(args, **kwargs, stdin=PIPE) </s> remove         if self.command == "train":
 </s> add         if self.command != "train": </s> remove             output = self.process.stderr.readline()
 </s> add             try:
                output = self.process.stderr.readline()
            except ValueError as err:
                if str(err).lower().startswith("i/o operation on closed file"):
                    break
                raise </s> remove             output = self.process.stdout.readline()
 </s> add             try:
                output = self.process.stdout.readline()
            except ValueError as err:
                if str(err).lower().startswith("i/o operation on closed file"):
                    break
                raise </s> remove                 while True:
                    timeelapsed = time() - now
                    if self.process.poll() is not None:
                        break
                    if timeelapsed > 30:
                        raise ValueError("Timeout reached sending Exit Signal")
 </s> add                     while True:
                        timeelapsed = time() - now
                        if self.process.poll() is not None:
                            break
                        if timeelapsed > 60:
                            raise ValueError("Timeout reached sending Exit Signal")
from subprocess import PIPE, Popen, TimeoutExpired
  """ Process wrapper for underlying faceswap commands for the GUI """
  import os
  import re
  import signal
from subprocess import PIPE, Popen, TimeoutExpired
  import sys
  import tkinter as tk
  from threading import Thread
  from time import time
  
keep keep keep keep replace keep keep keep keep keep
 GUI Bugfix: Crash on training termination (Windows) 
lib/gui/wrapper.py