4 stable releases
1.0.4 | Sep 11, 2021 |
---|---|
1.0.1 | Sep 10, 2021 |
#44 in #utils
9KB
dutty
simple teletype test dummy written in Rust.
Usage
$ dutty
Standard output is a TERMINAL
Standard input is a TERMINAL
Standard error is a TERMINAL
Here, dutty
recognised that its stdin, stdout and stderr streams were all from the terminal; so it told us that these streams were all terminals.
Let's try to redirect its standard IO to teletypes:
- Stdin
$ dutty < somefile
Standard output is a TERMINAL
Standard input is a TELETYPE
Standard error is a TERMINAL
Here, we redirected dutty
's standart input to a file (which is a teletype), so it told us that stdin was a teletype.
This also works with pipes:
$ head /dev/random | dutty
Standard output is a TERMINAL
Standard input is a TELETYPE
Standard error is a TERMINAL
You may also notice that dutty
colorizes the words TERMINAL
and TELETYPE
green and red, respectively. It does this even when its stdout or stderr is redirected, cause it uses the stubborn I/O (trying to write exactly to the console, regardless of the state of its stdio).
- Stdout
dutty
has a similar behaviour for stdout.
$ dutty | cat
Standard output is a TELETYPE
Standard input is a TERMINAL
Standard error is a TERMINAL
- Stderr
dutty
has the same behavior when its standard error is redirected.
$ dutty 2>| cat
Standard output is a TERMINAL
Standard input is a TERMINAL
Standard error is a TELETYPE
$ dutty |& cat
Standard output is a TELETYPE
Standard input is a TERMINAL
Standard error is a TELETYPE
Dependencies
~3.5MB
~58K SLoC