diff --git a/local-app/python-tools/gfl-resource-actions/aws_resource_management.py b/local-app/python-tools/gfl-resource-actions/aws_resource_management.py index 5afe76c3..a4d03dde 100644 --- a/local-app/python-tools/gfl-resource-actions/aws_resource_management.py +++ b/local-app/python-tools/gfl-resource-actions/aws_resource_management.py @@ -43,9 +43,13 @@ env = os.environ.copy() env['PYTHONPATH'] = script_dir + os.pathsep + env.get('PYTHONPATH', '') - # Run the command and exit with its return code - result = subprocess.run(cmd, env=env) - sys.exit(result.returncode) + try: + # Run the command and exit with its return code + result = subprocess.run(cmd, env=env) + sys.exit(result.returncode) + except KeyboardInterrupt: + print("\nOperation interrupted by user. Exiting gracefully...") + sys.exit(130) # Standard exit code for SIGINT/Ctrl+C finally: # Clean up the temporary file os.unlink(temp_file.name)