Rust atty
From wikinotes
A cross platform way of determining if your stdin/stdout/stderr is a tty or not.
built overtop of each platform's native APIs.
Documentation
github https://github.com/softprops/atty
Install
# Cargo.toml [dependencies] atty = "0.2"
Usage
if !atty::is(Stream::Stdin) { // read from pipe }