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

Fix issue where the open command runs as root

Here we take the currently logged in user, and run the open command as that user instead of root. This ensures that your default browser choice works.
This commit is contained in:
MrRio
2017-07-03 12:08:07 +01:00
parent 65618fe399
commit 26ae3f10b2

View File

@@ -184,8 +184,8 @@
*/
$app->command('open [domain]', function ($domain = null) {
$url = "http://".($domain ?: Site::host(getcwd())).'.'.Configuration::read()['domain'];
passthru("open ".escapeshellarg($url));
// Run the 'open' command as the currently logged in user instead of root
passthru('sudo --user=`stat -f%Su /dev/console` open ' . escapeshellarg($url));
})->descriptions('Open the site for the current (or specified) directory in your browser');
/**