Skip to content

Commit

Permalink
Merge pull request #297 from zhamao-robot/fix-plugin-install-cmd-bugs
Browse files Browse the repository at this point in the history
修复插件安装命令若干问题
  • Loading branch information
sunxyw committed Feb 11, 2023
2 parents 78977e5 + 4570012 commit a443dc7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ZM/Command/Plugin/PluginInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use ZM\Exception\FileSystemException;
use ZM\Plugin\PluginManager;
use ZM\Store\FileSystem;
use ZM\Utils\ZMRequest;
Expand Down Expand Up @@ -63,6 +64,12 @@ protected function handle(): int
}
}
$this->info('正在从 ' . $addr . ' 克隆插件仓库');
try {
FileSystem::createDir($plugin_dir);
} catch (FileSystemException $exception) {
$this->error("无法创建插件目录 {$plugin_dir}{$exception->getMessage()}");
return static::FAILURE;
}
passthru('cd ' . escapeshellarg($plugin_dir) . ' && git clone --depth=1 ' . escapeshellarg($addr) . ' ' . $name, $code);
if ($code !== 0) {
$this->error('无法从指定 Git 地址拉取项目,请检查地址名是否正确');
Expand Down Expand Up @@ -91,7 +98,7 @@ protected function handle(): int
// 使用内建 Composer
if (file_exists(WORKING_DIR . '/runtime/composer.phar')) {
$this->info('使用内建 Composer');
passthru('php ' . escapeshellarg(WORKING_DIR . '/runtime/composer.phar') . ' install --no-dev', $code);
passthru(PHP_BINARY . ' ' . escapeshellarg(WORKING_DIR . '/runtime/composer.phar') . ' install --no-dev', $code);
} else {
$this->info('使用系统 Composer');
passthru('composer install --no-dev', $code);
Expand Down

0 comments on commit a443dc7

Please sign in to comment.