az command returns 0 when failing
See original GitHub issueRelated command
az extension show -n azure-ml-cli
Describe the bug When azure-ml-cli is not installed, we expect an error with exitcode 1. This works properly for 2.39 and older, but with 2.40, it returns 0.
To Reproduce Run the following python script:
import subprocess
subprocess.run(args=['pwsh', '-EncodedCommand', 'YQB6ACAAZQB4AHQAZQBuAHMAaQBvAG4AIABzAGgAbwB3ACAALQBuACAAYQB6AHUAcgBlAC0AYwBsAGkALQBtAGwA'])
Outputs 2.40 2.39
Expected behavior CompletedProcess(args=[‘pwsh’, ‘-EncodedCommand’, ‘YQB6ACAAZQB4AHQAZQBuAHMAaQBvAG4AIABzAGgAbwB3ACAALQBuACAAYQB6AHUAcgBlAC0AYwBsAGkALQBtAGwA’], returncode=1)
Environment summary Windows, python 3.8
Additional context Similar to https://github.com/Azure/azure-cli/issues/23808
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How can I get a powershell script to exit with a non-zero code ...
When an az cli command returns an error the script keeps executing like nothing happened which is problematic.
Read more >while trying to run the az run command with the powershell ...
i am trying to run the below az run command but facing the error ... are trying to use RunPowerShellScript from azure CLI...
Read more >Azure Pipeline Step Fails Even Though Exit Code is 0
... failed with error: Error: /bin/bash failed with return code: 0 ... Some programs write logging messages to stderr (e.g. az --version ...
Read more >AZ Cli reports warnings that breaks Releases
az : WARNING: The default kind for created storage account will change to ... 'C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit ...
Read more >BashPitfalls - Greg's Wiki
If the command substitution returns multiple filenames, there is no way ... (This example still fails if we initialize i to -1 instead...
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
https://github.com/Azure/azure-cli/milestone/122 Build to Cloud Shell: 10/10/2022 Official Release: 10/12/2022
Hi Yong, will there be an IcM ticket filed for this issue? It is affecting all customers of the Substrate Intelligence AI platform and the Shrike library.