[PR #3263] Fix logger terminal state for colorama #3149

Open
opened 2026-10-28 21:15:38 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/ComfyUI-Manager/pull/3263
Author: @ICOM725
Created: 9/10/2026
Status: 🔄 Open

Base: main ← Head: codex/fix-logger-terminal-state


📝 Commits (1)

  • cc3909b fix: preserve logger terminal state for colorama

📊 Changes

3 files changed (+95 additions, -1 deletions)

View changed files

📝 prestartup_script.py (+7 -1)
➕ tests/requirements.txt (+2 -0)
➕ tests/test_logger_stream.py (+86 -0)

📄 Description

Fixes #3259.

ComfyUIManagerLogger now delegates isatty() and closed to the original stdout or stderr. This lets colorama preserve ANSI colors on terminals while continuing to strip them from redirected output.

Thanks to @hwprinz for identifying the stream-state mismatch and providing the initial fix direction. Added tests using the real logger and colorama to cover stdout/stderr, terminal/redirected output, and closed streams.

Validation on Windows: python -X utf8 -m pytest tests -q (55 passed, 14 server E2E tests skipped), ruff check ., and git diff --check. The 10 new cases exercise both colorama platform branches and fail on the original code (6 failed, 4 passed). Test dependencies are listed in tests/requirements.txt.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/ComfyUI-Manager/pull/3263 **Author:** [@ICOM725](https://github.com/ICOM725) **Created:** 9/10/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codex/fix-logger-terminal-state` --- ### 📝 Commits (1) - [`cc3909b`](https://github.com/Comfy-Org/ComfyUI-Manager/commit/cc3909b862ee7c0112e68521723e856b3f85b76c) fix: preserve logger terminal state for colorama ### 📊 Changes **3 files changed** (+95 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `prestartup_script.py` (+7 -1) ➕ `tests/requirements.txt` (+2 -0) ➕ `tests/test_logger_stream.py` (+86 -0) </details> ### 📄 Description Fixes #3259. ComfyUIManagerLogger now delegates isatty() and closed to the original stdout or stderr. This lets colorama preserve ANSI colors on terminals while continuing to strip them from redirected output. Thanks to @hwprinz for identifying the stream-state mismatch and providing the initial fix direction. Added tests using the real logger and colorama to cover stdout/stderr, terminal/redirected output, and closed streams. Validation on Windows: `python -X utf8 -m pytest tests -q` (55 passed, 14 server E2E tests skipped), `ruff check .`, and `git diff --check`. The 10 new cases exercise both colorama platform branches and fail on the original code (6 failed, 4 passed). Test dependencies are listed in `tests/requirements.txt`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/ComfyUI-Manager#3149
No description provided.