MCPcopy Index your code
hub / github.com/dtolnay/faketty

github.com/dtolnay/faketty @1.0.20

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.20 ↗ · + Follow
16 symbols 27 edges 3 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

faketty

github crates.io build status

A wrapper binary to exec a command in a pty, even if redirecting the output.

This allows logging the stdout and stderr (separately) of a process, without the output being different from what you'd see in the terminal if you weren't logging anything.

$ cargo install faketty
$ faketty bazel build :target >log/out 2>log/err
          ~~~~~~~~~~~~~~~~~~~ command to run

Background

When redirecting stdout/err to a pipe or file, a process may detect the output is no longer going to a tty (because it has no width/height, baud rate, etc) and may change its behavior accordingly. For example many programs that involve a progress bar or colored text in a terminal disable those things when the output is not going to a terminal.

There is a script(1) command which makes it possible to redirect a command's terminal-style output by executing it inside a pseudoterminal (pty) – a bidirectional pipe that also has width, height, etc and tricks the process into thinking it is talking to a real terminal. However, script only uses a single pty, which makes it impossible to demultiplex stdout and stderr to different places.

The faketty command in this repo is similar to script --quiet --return --command '...' /dev/null except that it preserves distinct stdout and stderr streams.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this program by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Core symbols most depended-on inside this repo

app
called by 2
src/main.rs
forkpty
called by 2
src/main.rs
copyfd
called by 2
src/main.rs
copyexit
called by 2
src/main.rs
try_main
called by 1
src/main.rs
args
called by 1
src/main.rs
exec
called by 1
src/main.rs
write_all
called by 1
src/main.rs

Shape

Function 11
Method 3
Enum 2

Languages

Rust100%

Modules by API surface

src/main.rs11 symbols
src/error.rs4 symbols
tests/test.rs1 symbols

For agents

$ claude mcp add faketty \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact