Fix Docker output by moving colorama init for ECS expressgateway commands#9878
Merged
Conversation
nateprewitt
reviewed
Nov 25, 2025
Contributor
nateprewitt
left a comment
There was a problem hiding this comment.
Couple small thoughts on tests, not blocking though. Otherwise, the PR looks good. Thanks @ashovlin!
d9d0977 to
cd39388
Compare
nateprewitt
approved these changes
Nov 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
--ttyflag, there'd be a new reset control code (^[[m) in the output.Now, this moves the
colorama.initcall into the no-longer-static ECSColorUtils, 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.