Skip to content

fix: check stderr for lib_std.sh color detection #653

@codeforester

Description

@codeforester

Summary

lib/bash/std/lib_std.sh initializes colors by checking whether stdout is a terminal, but the logging helpers write to stderr. When stdout is redirected while stderr is still attached to a terminal, log color is disabled even though the log stream can render it.

Action

  • Update __init_colors__ to check file descriptor 2 instead of file descriptor 1.
  • Add focused coverage for the redirected-stdout/stderr-terminal case where practical.
  • Preserve existing opt-out behavior when color is disabled explicitly.

Source

From the lib_std.sh Evolution Suggestions review item: "Color detection checks the wrong file descriptor."

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not workingtype:fix

    Projects

    Status
    Backlog

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions