diff --git a/src/azure/cli/__main__.py b/src/azure/cli/__main__.py index 22c1c1fcae9..05f2ac7d3db 100644 --- a/src/azure/cli/__main__.py +++ b/src/azure/cli/__main__.py @@ -1,9 +1,17 @@ -import sys +import sys +import os +import signal import azure.cli.main from azure.cli._telemetry import init_telemetry, user_agrees_to_telemetry, telemetry_flush +signal.signal(signal.SIGINT, lambda signum, frame: sys.exit(1)) + +if os.name != 'nt': + # can't call Windows with SIGPIPE + signal.signal(signal.SIGPIPE, lambda signum, frame: sys.exit(1)) + try: try: if user_agrees_to_telemetry():