# zed: Hide log file actions when logging to stdout \(\#57114\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/501ab50f9b03f1c3a13df11ade804bbdf11146ff)

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

Visibility: public

Requested revision: 501ab50f9b03f1c3a13df11ade804bbdf11146ff

Requested commit: 501ab50f9b03f1c3a13df11ade804bbdf11146ff

Commit: 501ab50f9b03f1c3a13df11ade804bbdf11146ff

Tree: 63aee613e0dcaf730763f640f591f4e25081e818

Author: Ted Robertson

Committer: GitHub

## Message

```
zed: Hide log file actions when logging to stdout (#57114)

When running `zed` [directly from a foreground
terminal](https://github.com/zed-industries/zed/issues/51351#issuecomment-4507962670)
(stable `zed-editor`, or zed dev builds via `cargo run` as in #51351),
Zed only enables the stdout log sink and never creates `Zed.log` on
disk. This causes `zed: open log` and `zed: reveal log in file manager`
to always failed with `Unable to access/open log file ...: Failed to
read file... No such file or directory (os error 2)`.

Per maintainer feedback, rather than always creating the log file, this
change only registers the `OpenLog` and `RevealLogInFileManager` action
handlers when stdout isn't a PTY. In the PTY case the two actions no
longer appear in the command palette at all, so they can't be invoked
only to error.

Repro (before this change):
1. `rm -rf ~/.local/share/zed/logs/`
2. `~/.local/zed.app/libexec/zed-editor` (the GUI binary directly,
bypassing the CLI wrapper which detaches and sets `ZED_FORCE_CLI_MODE`)
3. In Zed, run `zed: open log` → error toast

Release Notes:

- Fixed `zed: open log` and `zed: reveal log in file manager` appearing
and erroring when Zed was launched directly from a terminal. These
actions are now hidden in that scenario, since logs go to stdout rather
than Zed's log file.

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
```

## Parents

- [53f1ae01a4480f07a70ac49182ab00134ef4a1da](https://git.cafe/gitcafe/zed/commit/53f1ae01a4480f07a70ac49182ab00134ef4a1da?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/501ab50f9b03f1c3a13df11ade804bbdf11146ff?format=markdown)
