def cmd(self, cmd, stdin=None, cwd=None, ignore_errors=False, encoding=None, fallback=None):
        command = self.build_command(cmd)
        environment = self.env()
        encoding = encoding or get_setting('encoding', 'utf-8')
        fallback = fallback or get_setting('fallback_encodings', [])

        try:
            logger.debug("cmd: %s", command)

            if stdin and hasattr(stdin, 'encode'):
                stdin = stdin.encode(encoding)

            if cwd:
                os.chdir(cwd)

            proc = subprocess.Popen(command,
                                    stdin=subprocess.PIPE,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE,
                                    startupinfo=self.startupinfo(),
                                    env=environment)
            stdout, stderr = proc.communicate(stdin)

            logger.debug("out: (%s) %s", proc.returncode, [stdout[:100]])

            return (proc.returncode, self.decode(stdout, encoding, fallback), self.decode(stderr, encoding, fallback))
        except OSError as e:
            if ignore_errors:
                return (0, '')
            sublime.error_message(self.get_executable_error())
            raise SublimeGitException("Could not execute command: %s" % e)
        except __HOLE__ as e:
            if ignore_errors:
                return (0, '')
            sublime.error_message(self.get_decoding_error(encoding, fallback))
            raise SublimeGitException("Could not execute command: %s" % command)

    # async commands
dataset/ETHPy150Open SublimeGit/SublimeGit/sgit/cmd.py/Cmd.cmd