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

Addressing issue #678

This commit is contained in:
Sahib J. Leo
2018-12-04 02:04:17 -06:00
committed by Matt Stauffer
parent 8f03204b61
commit b05c773e1d
4 changed files with 8 additions and 8 deletions

View File

@@ -130,7 +130,7 @@ function tap($formulas)
$formulas = is_array($formulas) ? $formulas : func_get_args();
foreach ($formulas as $formula) {
$this->cli->passthru('sudo -u '.user().' brew tap '.$formula);
$this->cli->passthru('sudo -u "'.user().'" brew tap '.$formula);
}
}

View File

@@ -25,7 +25,7 @@ function quietly($command)
*/
function quietlyAsUser($command)
{
$this->quietly('sudo -u '.user().' '.$command.' > /dev/null 2>&1');
$this->quietly('sudo -u "'.user().'" '.$command.' > /dev/null 2>&1');
}
/**
@@ -60,7 +60,7 @@ function run($command, callable $onError = null)
*/
function runAsUser($command, callable $onError = null)
{
return $this->runCommand('sudo -u '.user().' '.$command, $onError);
return $this->runCommand('sudo -u "'.user().'" '.$command, $onError);
}
/**

View File

@@ -133,9 +133,9 @@ public function test_has_installed_php_indicates_if_php_is_installed_via_brew()
public function test_tap_taps_the_given_homebrew_repository()
{
$cli = Mockery::mock(CommandLine::class);
$cli->shouldReceive('passthru')->once()->with('sudo -u '.user().' brew tap php71');
$cli->shouldReceive('passthru')->once()->with('sudo -u '.user().' brew tap php70');
$cli->shouldReceive('passthru')->once()->with('sudo -u '.user().' brew tap php56');
$cli->shouldReceive('passthru')->once()->with('sudo -u "'.user().'" brew tap php71');
$cli->shouldReceive('passthru')->once()->with('sudo -u "'.user().'" brew tap php70');
$cli->shouldReceive('passthru')->once()->with('sudo -u "'.user().'" brew tap php56');
swap(CommandLine::class, $cli);
resolve(Brew::class)->tap('php71', 'php70', 'php56');
}

4
valet
View File

@@ -5,7 +5,7 @@ SOURCE="${BASH_SOURCE[0]}"
# If the current source is a symbolic link, we need to resolve it to an
# actual directory name. We'll use PHP to do this easier than we can
# do it in pure Bash. So, we'll call into PHP CLI here to resolve.
if [[ -L $SOURCE ]]
if [[ -L "$SOURCE" ]]
then
DIR=$(php -r "echo dirname(realpath('$SOURCE'));")
else
@@ -22,7 +22,7 @@ fi
if [[ "$EUID" -ne 0 ]]
then
sudo $SOURCE "$@"
sudo "$SOURCE" "$@"
exit
fi