From 0a33373bb6b3ee7ac3c294535ea66ed02c902be4 Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Wed, 26 Jul 2023 15:54:51 +0200 Subject: [PATCH] Only delete resolver when Herd is not installed --- cli/Valet/DnsMasq.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cli/Valet/DnsMasq.php b/cli/Valet/DnsMasq.php index 2806824..0366daa 100644 --- a/cli/Valet/DnsMasq.php +++ b/cli/Valet/DnsMasq.php @@ -43,8 +43,13 @@ public function uninstall(): void $this->brew->stopService('dnsmasq'); $this->brew->uninstallFormula('dnsmasq'); $this->cli->run('rm -rf '.BREW_PREFIX.'/etc/dnsmasq.d/dnsmasq-valet.conf'); - $tld = $this->configuration->read()['tld']; - $this->files->unlink($this->resolverPath.'/'.$tld); + + // As Laravel Herd uses the same DnsMasq resolver, we should only + // delete if, if Herd is not installed. + if (!$this->files->exists('/Applications/Herd.app')) { + $tld = $this->configuration->read()['tld']; + $this->files->unlink($this->resolverPath . '/' . $tld); + } } /**