Ref : https://github.com/python/cpython/pull/25174

https://github.com/localstack/localstack/blob/5a5edcd9d9ccbd6a56f23d71e3a1131b8c814996/localstack/utils/common.py#L324
""" Helper class to run a shell command in a background thread. """
    def __init__(self, cmd, params={}, outfile=None, env_vars={}, stdin=False, auto_restart=False,
            quiet=True, inherit_cwd=False, inherit_env=True, log_listener=None):
        self.cmd = cmd
        self.process = None
        self.outfile = outfile
        self.stdin = stdin
        self.env_vars = env_vars
        self.inherit_cwd = inherit_cwd
        self.inherit_env = inherit_env
        self.log_listener = log_listener
        self.auto_restart = auto_restart
        FuncThread.__init__(self, self.run_cmd, params, quiet=quiet)
    def run_cmd(self, params):