Skip to content

Improve TTY detection and automatic stripping #138

@hbisneto

Description

@hbisneto

Problem: ANSI codes are emitted even when output is redirected, unless manually stripped

Why it matters: Logs and files should not contain escape sequences unless explicitly requested.

Proposed solution: On each call, check sys.stdout.isatty() and sys.stderr.isatty(); if false, return plain text unless force_color=True is passed. Update AnsiToWin32 init to respect this flag.

Notes: Preserve existing init(strip=True) for global control; add per-call override for flexibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Console ModuleRelated to the "Console" module inside FileSystemPro

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions