← Back to team overview

sts-sponsors team mailing list archive

Re: [Merge] ~alexsander-souza/maas:colorama_strikes_back into maas:master

 


Diff comments:

> diff --git a/src/maascli/utils.py b/src/maascli/utils.py
> index f35e929..f38aa5b 100644
> --- a/src/maascli/utils.py
> +++ b/src/maascli/utils.py
> @@ -159,14 +175,10 @@ def print_response_content(response, content, file=None):
>      :param file: a binary stream opened for writing (optional)
>      """
>      file = sys.stdout if file is None else file

well...

sys.__stdout__ if file is None else file

> +    file = get_orig_stdout(file)
>      is_tty = file.isatty()
>      success = response.status // 100 == 2
>      is_textual = is_response_textual(response)
> -    # Get the underlying buffer if we're writing to stdout. This allows us to
> -    # write bytes directly, without attempting to convert the bytes to unicode.
> -    # Unicode output may not be desired; the HTTP response could be raw bytes.
> -    if isinstance(file, io.TextIOWrapper):
> -        file = file.buffer
>      if is_tty and success and is_textual:
>          file.write(b"Success.\n")
>          file.write(b"Machine-readable output follows:\n")


-- 
https://code.launchpad.net/~alexsander-souza/maas/+git/maas/+merge/434386
Your team MAAS Committers is subscribed to branch maas:master.



References