code: def exec_command(self, command, getOutput=True):
          
          if getOutput:
              with subprocess.Popen(
                      command,
                      shell=True,
                      bufsize=-1,
                      stdout=subprocess.PIPE,
                      universal_newlines=True) as p:
                  output = p.communicate()[0][:-1]  # Drop the trailing newline character
                  if p.returncode:
                      raise subprocess.CalledProcessError(p.returncode, output)
                  return output
          else:
              subprocess.Popen(command, shell=True, bufsize=-1)
docs: Execute a shell command
          
          Usage: C{system.exec_command(command, getOutput=True)}
  
          Set getOutput to False if the command does not exit and return immediately. Otherwise
          AutoKey will not respond to any hotkeys/abbreviations etc until the process started
          by the command exits.
          
          @param command: command to be executed (including any arguments) - e.g. "ls -l"
          @param getOutput: whether to capture the (stdout) output of the command
          @raise subprocess.CalledProcessError: if the command returns a non-zero exit code