diff --git a/src/runtime/ArcanistRuntime.php b/src/runtime/ArcanistRuntime.php --- a/src/runtime/ArcanistRuntime.php +++ b/src/runtime/ArcanistRuntime.php @@ -141,6 +141,12 @@ ->setConfigurationSourceList($config) ->resolveAliases($unconsumed_argv); + foreach ($alias_effects as $alias_effect) { + if ($alias_effect->getType() === ArcanistAliasEffect::EFFECT_SHELL) { + return $this->executeShellAlias($alias_effect); + } + } + $result_argv = $this->applyAliasEffects($alias_effects, $unconsumed_argv); $args->setUnconsumedArgumentVector($result_argv); @@ -727,4 +733,15 @@ return $engine; } + private function executeShellAlias(ArcanistAliasEffect $effect) { + $log = $this->getLogEngine(); + + $message = $effect->getMessage(); + if ($message !== null) { + $log->writeHint(pht('SHELL ALIAS'), $message); + } + + return phutil_passthru('%Ls', $effect->getArguments()); + } + } diff --git a/src/toolset/ArcanistAliasEngine.php b/src/toolset/ArcanistAliasEngine.php --- a/src/toolset/ArcanistAliasEngine.php +++ b/src/toolset/ArcanistAliasEngine.php @@ -199,22 +199,31 @@ } } + $alias_argv = $alias->getCommand(); + $alias_command = array_shift($alias_argv); + if ($alias->isShellCommandAlias()) { + $shell_command = substr($alias_command, 1); + + $shell_argv = array_merge( + array($shell_command), + $alias_argv, + $argv); + + $shell_display = csprintf('%Ls', $shell_argv); + $results[] = $this->newEffect(ArcanistAliasEffect::EFFECT_SHELL) ->setMessage( pht( '%s %s -> $ %s', $toolset_key, $command, - $alias->getShellCommand())) - ->setCommand($command) - ->setArgv($argv); + $shell_display)) + ->setArguments($shell_argv); + return $results; } - $alias_argv = $alias->getCommand(); - $alias_command = array_shift($alias_argv); - if (isset($stack[$alias_command])) { $cycle = array_keys($stack);