def run(self):
        # Ignore directories that no longer exist
        if not os.path.isdir(self.working_dir):
            return

        self.command_lock.acquire()
        output = ''
        callback = self.on_done
        try:
            if self.working_dir != "":
                os.chdir(self.working_dir)
            # Windows needs startupinfo in order to start process in background
            startupinfo = None
            if os.name == 'nt':
                startupinfo = subprocess.STARTUPINFO()
                startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW

            env = os.environ.copy()

            shell = False
            if sublime.platform() == 'windows':
                shell = True
                if 'HOME' not in env:
                    env[str('HOME')] = str(env['USERPROFILE'])

            # universal_newlines seems to break `log` in python3
            proc = subprocess.Popen(self.command,
                stdout=self.stdout, stderr=subprocess.STDOUT,
                stdin=subprocess.PIPE, startupinfo=startupinfo,
                shell=shell, universal_newlines=False,
                env=env)
            output = proc.communicate(self.stdin)[0]
            if self.error_suppresses_output and proc.returncode is not None and proc.returncode > 0:
                output = False
            if not output:
                output = ''
            output = _make_text_safeish(output, self.fallback_encoding)
        except subprocess.CalledProcessError as e:
            if self.error_suppresses_output:
                output = ''
            else:
                output = e.returncode
        except __HOLE__ as e:
            callback = sublime.error_message
            if e.errno == 2:
                global _has_warned
                if not _has_warned:
                    _has_warned = True
                    output = "{cmd} binary could not be found in PATH\n\nConsider using the {cmd_setting}_command setting for the Git plugin\n\nPATH is: {path}".format(cmd=self.command[0], cmd_setting=self.command[0].replace('-', '_'), path=os.environ['PATH'])
            else:
                output = e.strerror
        finally:
            self.command_lock.release()
            main_thread(callback, output, **self.kwargs)


# A base for all commands
dataset/ETHPy150Open kemayo/sublime-text-git/git/__init__.py/CommandThread.run