def output_of(args: str | list[str], **kwargs) -> str:
    """Invokes a subprocess and returns its output as a string.

    Args:
        args: The arguments for launching the process.  This may be a list
            or a string, for example, ["echo", "dog"] or "pwd".  The string
            type may need to be used with ``shell=True`` to allow invocation
            as a shell command, otherwise the string is used as a command name
            with no arguments.
        **kwargs: Extra arguments for the shell_tools.run function, such as
            a cwd (current working directory) argument.

    Returns:
        str: The standard output of the command with the last newline removed.

    Raises:
         subprocess.CalledProcessError: The process returned a non-zero error
            code and the `check` flag was True (default).
    """
    result = run(args, log_run_to_stderr=False, stdout=subprocess.PIPE, **kwargs).stdout

    # Strip final newline.
    if result.endswith('\n'):
        result = result[:-1]

    return result
Invokes a subprocess and returns its output as a string.

    Args:
        args: The arguments for launching the process.  This may be a list
            or a string, for example, ["echo", "dog"] or "pwd".  The string
            type may need to be used with ``shell=True`` to allow invocation
            as a shell command, otherwise the string is used as a command name
            with no arguments.
        **kwargs: Extra arguments for the shell_tools.run function, such as
            a cwd (current working directory) argument.

    Returns:
        str: The standard output of the command with the last newline removed.

    Raises:
         subprocess.CalledProcessError: The process returned a non-zero error
            code and the `check` flag was True (default).
    
dev_tools/shell_tools.py