# terminal: Fix terminal not closing after non-zero shell exit \(\#52520\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 80b86cef24f485bdb5b6a0db78ba3ce57667a35b

Requested commit: 80b86cef24f485bdb5b6a0db78ba3ce57667a35b

Commit: 80b86cef24f485bdb5b6a0db78ba3ce57667a35b

Tree: a13ef3d0a31e3403cc59e06e412ab31f7769644a

Author: Smit Barmase

Committer: GitHub

## Message

```
terminal: Fix terminal not closing after non-zero shell exit (#52520)

Closes https://github.com/zed-industries/zed/issues/38901

Supersedes https://github.com/zed-industries/zed/pull/39082

This PR fixes an issue where the terminal tab would stay open after the
user exits a shell that has a non-zero exit code (e.g. running `false`
then `exit`, or pressing Ctrl-C followed by Ctrl-D). We now track
whether any keyboard input was sent to distinguish user-initiated exits
from shell spawn failures.

Release Notes:

- Fixed terminal tab not closing when the shell exits with a non-zero
code.

Co-authored-by: Glenn Miao <one.lemorage@gmail.com>
```

## Parents

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

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