azure-cli crash when redirecting output
See original GitHub issueazure-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 https://github.com/Azure/azure-cli/issues/58 and https://github.com/Azure/azure-cli/issues/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
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
powershell redirect error from az cli command - Stack Overflow
Powershell will eat your $null , so azure cli won't redirect. You can also try checking for the db first with az mysql...
Read more >Analyzing system crashes on non-persistent machines
1. Get notified of server crashes and determine the computer name(s) · 2. Secure the dump file (*.DMP) for further analysis. Redirect the...
Read more >Telemetry - Visual Studio Code
Crash Reports - Crash reports collect diagnostic information when VS Code crashes and sends it to Microsoft to help understand why the crash...
Read more >How to Live Tail Docker Logs - Papertrail
Therefore, you won't see any logging or other output from your Docker container. ... Enter the following command in your command-line interface (CLI), ......
Read more >redirecting to /dev/null - shell script - Unix Stack Exchange
the script will still crash. This is because of using > /dev/null 2>&1 will redirect all your command output (both stdout and stderr...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue is caused by the colorama code for survey link. You can turn off the link with
export AZURE_OUTPUT_SHOW_SURVEY_LINK=False
or disable the color for all command output withexport AZURE_CORE_NO_COLOR=True
.For the purpose of parsing Azure CLI version, we recommend
az version
, the output is a simple json.az version --query '"azure-cli"'
gives you the version"2.5.1"
on Linux.I re-thought about this issue today and it is actually a colorama bug with
head
command (linked above 👆).Anyway, we no longer init colorama if
stdout
is not a TTY, so we are good.