rust-lang / rust-lang/rust

Feature request: `std::io::Sink` should implement `std::io::IsTerminal` (returning `false`)

Open Beginner friendly
#161,941 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature-request T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I have a tool which formats output and error messages on the terminal depending on the terminal size and therefore needs to query io::IsTerminal often. I have a trait RenderTarget: io::Write + io::IsTerminal which is used throughout the code.

Today I had the need to pass io::sink() to a function expecting a RenderTarget but io::sink() does not implement io::IsTerminal, and I cannot implement the latter for a wrapper type because it is sealed.

So I'm out of luck. I've found an ugly workaround but I think it would be harmless to have io::sink() implement io::IsTerminal always returning false.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the standard-library definitions and implementations for std::io::Sink and std::io::IsTerminal, then inspect nearby tests for terminal detection. Add the requested Sink behavior and verify that it reports false without changing other terminal implementations.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.