1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-05 00:20:08 +01:00

Restore original directory permissions

As discussed in #1220, cleaning up after stopping Homebrew services that
run as root is probably the best solution for now.

What's changed:

- Stopping any Homebrew service now restores the appropriate permissions
  for the Homebrew directories
- Stopping nginx now also happens via $this->brew
  (to avoid code duplication)

The tests were updated to reflect this change.
This commit is contained in:
2022-03-29 19:38:30 +02:00
parent b406c0d4ee
commit a52355ec49
3 changed files with 18 additions and 3 deletions

View File

@@ -122,6 +122,9 @@ public function test_stop_stops_the_service_using_homebrew_services()
$cli->shouldReceive('runAsUser')->once()->with('brew info dnsmasq --json')->andReturn('[{"name":"dnsmasq","full_name":"dnsmasq","aliases":[],"versioned_formulae":[],"versions":{"stable":"1"},"installed":[{"version":"1"}]}]');
$cli->shouldReceive('quietly')->once()->with('brew services stop dnsmasq');
$cli->shouldReceive('quietly')->once()->with('sudo brew services stop dnsmasq');
$cli->shouldReceive('quietly')->once()->with("sudo chown -R ".user().":admin '".BREW_PREFIX."/Cellar/dnsmasq'");
$cli->shouldReceive('quietly')->once()->with("sudo chown -R ".user().":admin '".BREW_PREFIX."/opt/dnsmasq'");
$cli->shouldReceive('quietly')->once()->with("sudo chown -R ".user().":admin '".BREW_PREFIX."/var/homebrew/linked/dnsmasq'");
swap(CommandLine::class, $cli);
resolve(Brew::class)->stopService('dnsmasq');
}