Skip to content

Please provide a portable isatty function for stdin/stdout/stderr #33736

Closed
@joshtriplett

Description

@joshtriplett

Some programs want to automatically emit color output, or spawn a pager, if output goes to a terminal, but not with redirected output. libtest has a function stdout_isatty, and rustc's libsyntax has a function stderr_isatty, with almost identical copy/pasted code other than the fd/handle checked. This strongly suggests the need for a library implementation.

Please consider providing a portable implementation of "isatty" for the Stdin, Stdout, and Stderr types, based on the above implementations from rustc/libtest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions