{"id":15401148,"url":"https://github.com/sunfishcode/is-terminal","last_synced_at":"2025-04-08T09:06:04.961Z","repository":{"id":42193911,"uuid":"450693203","full_name":"sunfishcode/is-terminal","owner":"sunfishcode","description":"Test whether a given stream is a terminal","archived":false,"fork":false,"pushed_at":"2025-03-07T04:26:22.000Z","size":114,"stargazers_count":49,"open_issues_count":0,"forks_count":18,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-04T06:07:18.942Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunfishcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-22T02:03:03.000Z","updated_at":"2025-03-07T19:30:41.000Z","dependencies_parsed_at":"2023-12-28T16:50:55.114Z","dependency_job_id":"a6dd7752-5030-4a71-a170-769ebb91306c","html_url":"https://github.com/sunfishcode/is-terminal","commit_stats":{"total_commits":58,"total_committers":13,"mean_commits":4.461538461538462,"dds":"0.22413793103448276","last_synced_commit":"fe7bc25b97efdbc59c2420a2333dead79746a77e"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fis-terminal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fis-terminal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fis-terminal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fis-terminal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunfishcode","download_url":"https://codeload.github.com/sunfishcode/is-terminal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247809963,"owners_count":20999816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T15:56:37.040Z","updated_at":"2025-04-08T09:06:04.911Z","avatar_url":"https://github.com/sunfishcode.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003e\u003ccode\u003eis-terminal\u003c/code\u003e\u003c/h1\u003e\n\n  \u003cp\u003e\n    \u003cstrong\u003eTest whether a given stream is a terminal\u003c/strong\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/sunfishcode/is-terminal/actions?query=workflow%3ACI\"\u003e\u003cimg src=\"https://github.com/sunfishcode/is-terminal/workflows/CI/badge.svg\" alt=\"Github Actions CI Status\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/is-terminal\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/is-terminal.svg\" alt=\"crates.io page\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://docs.rs/is-terminal\"\u003e\u003cimg src=\"https://docs.rs/is-terminal/badge.svg\" alt=\"docs.rs docs\" /\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\nAs of Rust 1.70, most users should use the [`IsTerminal`] trait in the Rust\nstandard library instead of this crate.\n\nOn Unix platforms, this crate now uses libc, so that the implementation\nmatches what's in std. Users wishing to use the rustix-based implementation\ncan use the [rustix-is-terminal] crate instead.\n\n[rustix-is-terminal]: https://crates.io/crates/rustix-is-terminal\n\n\u003chr\u003e\n\nis-terminal is a simple utility that answers one question:\n\n\u003e Is this a terminal?\n\nA \"terminal\", also known as a \"tty\", is an I/O device which may be interactive\nand may support color and other special features. This crate doesn't provide\nany of those features; it just answers this one question.\n\nOn Unix-family platforms, this is effectively the same as the [`isatty`]\nfunction for testing whether a given stream is a terminal, though it accepts\nhigh-level stream types instead of raw file descriptors.\n\nOn Windows, it uses a variety of techniques to determine whether the given\nstream is a terminal.\n\nThis crate is derived from [the atty crate] with [PR \\#51] bug fix and\n[PR \\#54] port to windows-sys applied. The only additional difference is that\nthe atty crate only accepts stdin, stdout, or stderr, while this crate accepts\nany stream. In particular, this crate does not access any stream that is not\npassed to it, in accordance with [I/O safety].\n\n[PR \\#51]: https://github.com/softprops/atty/pull/51\n[PR \\#54]: https://github.com/softprops/atty/pull/54\n\n## Example\n\n```rust\nuse is_terminal::IsTerminal;\n\nfn main() {\n    if std::io::stdout().is_terminal() {\n        println!(\"Stdout is a terminal\");\n    } else {\n        println!(\"Stdout is not a terminal\");\n    }\n}\n```\n\n## Testing\n\nThis library is tested on both Unix-family and Windows platforms.\n\nTo test it on a platform manually, use the provided `stdio` example program.\nWhen run normally, it prints this:\n\n```bash\n$ cargo run --example stdio\nstdin? true\nstdout? true\nstderr? true\n```\n\nTo test stdin, pipe some text to the program:\n\n```bash\n$ cat | cargo run --example stdio\nstdin? false\nstdout? true\nstderr? true\n```\n\nTo test stdout, pipe the program to something:\n\n```bash\n$ cargo run --example stdio | cat\nstdin? true\nstdout? false\nstderr? true\n```\n\nTo test stderr, pipe the program to something redirecting stderr:\n\n```bash\n$ cargo run --example stdio 2\u003e\u00261 | cat\nstdin? true\nstdout? false\nstderr? false\n```\n\n# Minimum Supported Rust Version (MSRV)\n\nThis crate currently works on the version of [Rust on Debian stable], which is\ncurrently Rust 1.63. This policy may change in the future, in minor version\nreleases, so users using a fixed version of Rust should pin to a specific\nversion of this crate.\n\n[`isatty`]: https://man7.org/linux/man-pages/man3/isatty.3.html\n[the atty crate]: https://crates.io/crates/atty\n[I/O safety]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md\n[Rust on Debian stable]: https://packages.debian.org/stable/rust/rustc\n[`IsTerminal`]: https://doc.rust-lang.org/stable/std/io/trait.IsTerminal.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunfishcode%2Fis-terminal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunfishcode%2Fis-terminal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunfishcode%2Fis-terminal/lists"}