# std.debug.lockStderrWriter: also return ttyconf · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/74931fe25cdd94e1cd08b5ece9dcce19959bc079)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 74931fe25cdd94e1cd08b5ece9dcce19959bc079

Requested commit: 74931fe25cdd94e1cd08b5ece9dcce19959bc079

Commit: 74931fe25cdd94e1cd08b5ece9dcce19959bc079

Tree: 75449b1d594d55a872aeb03f2dd3be16ac396274

Author: Matthew Lugg

Committer: Matthew Lugg

## Message

```
std.debug.lockStderrWriter: also return ttyconf

`std.Io.tty.Config.detect` may be an expensive check (e.g. involving
syscalls), and doing it every time we need to print isn't really
necessary; under normal usage, we can compute the value once and cache
it for the whole program's execution. Since anyone outputting to stderr
may reasonably want this information (in fact they are very likely to),
it makes sense to cache it and return it from `lockStderrWriter`. Call
sites who do not need it will experience no significant overhead, and
can just ignore the TTY config with a `const w, _` destructure.

```

## Parents

- [74c23a237ef5245b63eb06b832a511aabeb715c0](https://git.cafe/gitcafe/zig/commit/74c23a237ef5245b63eb06b832a511aabeb715c0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/74931fe25cdd94e1cd08b5ece9dcce19959bc079?format=markdown)
