Skip to content

azure-cli crash when redirecting output #13413

@johanburati

Description

@johanburati

azure-cli crash when redirecting output to some commands:

$ az --version | head -1
azure-cli                          2.5.1
The command failed with an unexpected error. Here is the traceback:

[Errno 32] Broken pipe
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 207, in invoke
    self.show_version()
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 108, in show_version
    print(ver_string)
  File "/opt/az/lib/python3.6/site-packages/colorama/ansitowin32.py", line 41, in write
    self.__convertor.write(text)
  File "/opt/az/lib/python3.6/site-packages/colorama/ansitowin32.py", line 162, in write
    self.write_and_convert(text)
  File "/opt/az/lib/python3.6/site-packages/colorama/ansitowin32.py", line 190, in write_and_convert
    self.write_plain_text(text, cursor, len(text))
  File "/opt/az/lib/python3.6/site-packages/colorama/ansitowin32.py", line 196, in write_plain_text
    self.wrapped.flush()
BrokenPipeError: [Errno 32] Broken pipe

To open an issue, please run: 'az feedback'
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

$ cat /etc/os-release | head  -1
NAME="Ubuntu"

$ az --version | tail -1
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy

Same issue has already been reported previously in #58 and #770, those are now closed but still seeing the issue.

Environment

Linux-4.15.0-1082-azure-x86_64-with-debian-stretch-sid
Python 3.6.5
Installer: DEB

azure-cli 2.5.1

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions