code: def runCommand(cmd, timeout=None, window=None):
      
      p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
      output = ''
      for line in p.stdout:
          line = line.decode(errors='replace' if (sys.version_info) < (3, 5) else 'backslashreplace').rstrip()
          output += line
          print(line)
          window.Refresh() if window else None        # yes, a 1-line if, so shoot me
  
      retval = p.wait(timeout)
      return (retval, output)
docs: run shell command
  	@param cmd: command to execute
  	@param timeout: timeout for command execution
  	@param window: the PySimpleGUI window that the output is going to (needed to do refresh on)
  	@return: (return code from command, command output)