Skip to content

Fix Docker output by moving colorama init for ECS expressgateway commands#9878

Merged
ashovlin merged 2 commits into
aws:v2from
ashovlin:shovlia/colorama-fix
Nov 26, 2025
Merged

Fix Docker output by moving colorama init for ECS expressgateway commands#9878
ashovlin merged 2 commits into
aws:v2from
ashovlin:shovlia/colorama-fix

Conversation

@ashovlin
Copy link
Copy Markdown
Member

@ashovlin ashovlin commented Nov 25, 2025

Issue #, if available: #9864

Description of changes: The recent ECS expressgateway commands added a call to colorama.init() on import, which happens as we register the commands via the handlers. So this was always getting called, even if the user is using other AWS CLI commands.

This caused the linked issue, where if a user is piping command output out of a Docker container with the --tty flag, there'd be a new reset control code (^[[m) in the output.

Now, this moves the colorama.init call into the no-longer-static ECS ColorUtils, so it will only be called if the user is using the new ECS commands.

Note: I tried to add a test that mimicked the Docker pseudo-TTY but couldn't get it working quickly. We have Docker smoke tests in the internal pipeline that we can add this to. For now, added a test that ensures colorama is not initialized outside of where we use it.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ashovlin ashovlin requested a review from aemous November 25, 2025 19:17
Copy link
Copy Markdown
Contributor

@nateprewitt nateprewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple small thoughts on tests, not blocking though. Otherwise, the PR looks good. Thanks @ashovlin!

Comment thread tests/functional/test_output.py Outdated
Comment thread tests/unit/customizations/ecs/expressgateway/test_color_utils.py Outdated
@ashovlin ashovlin force-pushed the shovlia/colorama-fix branch from d9d0977 to cd39388 Compare November 25, 2025 20:45
@ashovlin ashovlin merged commit a57d9ca into aws:v2 Nov 26, 2025
45 checks passed
@ashovlin ashovlin deleted the shovlia/colorama-fix branch November 26, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants