# auto_update: Fix installer temp dirs leaking on macOS \(\#60528\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 2eeca73e665a814c5b1430a3bfd8aacff0477fb3

Requested commit: 2eeca73e665a814c5b1430a3bfd8aacff0477fb3

Commit: 2eeca73e665a814c5b1430a3bfd8aacff0477fb3

Tree: 7d325873a47ac8986a36583cd17ef53be7121614

Author: Lukas Wirth

Committer: GitHub

## Message

```
auto_update: Fix installer temp dirs leaking on macOS (#60528)

The unmount of the update disk image was made async-and-detached in
#38867, which introduced a race: the installer TempDir was dropped
(running remove_dir_all) while the DMG was still mounted inside it. The
removal failed silently, leaking a zed-auto-update* dir containing the
~140 MB DMG in /private/var/folders on every update.

Now the unmount is awaited before the temp dir is dropped (installation
already runs on the background executor since #58767, so this no longer
blocks the UI), with the Drop impl kept as a safety net for early exits
and cancellation. Additionally, stale installer dirs older than 24 hours
are swept from the temp dir when update polling starts, so existing
accumulated leaks get reclaimed.

Closes FR-104
Closes #58835

Release Notes:

- Fixed the macOS auto-updater leaking a copy of the downloaded update
in the system temp directory on every update, and added cleanup of
previously leaked files.
```

## Parents

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

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