(command: List[str], timeout: int = COMMAND_TIMEOUT)
return ""
Execute a command in a subprocess.
Execute a command in a subprocess.
Execute a command in a subprocess .
def shell(command: List[str], timeout: int = COMMAND_TIMEOUT) -> str:
    """Execute a command in a subprocess."""
    try:
        result = subprocess.run(
            command,
            check=True,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            timeout=timeout,
        )
        return result.stdout.decode("utf-8", errors="ignore").rstrip()
    except subprocess.CalledProcessError:
        pass
    except subprocess.TimeoutExpired:
        raise click.Abort('Command "{}" timed out'.format(" ".join(command)))
    except Exception as exc:
        raise click.ClickException(
            f"Unhandled exception: {' '.join(command)}\n\t{str(exc)}"
        )

    return ""
def shell ( command : List [ str ] , timeout : int = COMMAND_TIMEOUT ) -> str : try : result = subprocess . run ( command , check = True , stdout = subprocess . PIPE , stderr = subprocess . PIPE , timeout = timeout , ) return result . stdout . decode ( "utf-8" , errors = "ignore" ) . rstrip ( ) except subprocess . CalledProcessError : pass except subprocess . TimeoutExpired : raise click . Abort ( 'Command "{}" timed out' . format ( " " . join ( command ) ) ) except Exception as exc : raise click . ClickException ( f"Unhandled exception: {' '.join(command)}\n\t{str(exc)}" ) return ""