mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-25 01:25:34 +08:00
fix built-in composer not working with init command
This commit is contained in:
@@ -72,9 +72,14 @@ class InitCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$section->writeln('<info>完成</info>');
|
$section->writeln('<info>完成</info>');
|
||||||
|
|
||||||
$section->write('<fg=gray>执行 composer dump-autoload ... </>');
|
$section->write('<fg=gray>执行 composer dump-autoload ... </>');
|
||||||
exec('composer dump-autoload');
|
|
||||||
|
// 兼容内建 Composer
|
||||||
|
$env = getenv('COMPOSER_EXECUTABLE');
|
||||||
|
if ($env === false) {
|
||||||
|
$env = 'composer';
|
||||||
|
}
|
||||||
|
passthru(PHP_BINARY . ' ' . escapeshellcmd($env) . ' dump-autoload');
|
||||||
|
|
||||||
$section->writeln('<info>完成</info>');
|
$section->writeln('<info>完成</info>');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ final class ConsoleApplication extends Application
|
|||||||
FileSystem::getClassesPsr4(SOURCE_ROOT_DIR . '/src/Command', 'Command')
|
FileSystem::getClassesPsr4(SOURCE_ROOT_DIR . '/src/Command', 'Command')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// 初始化 Composer 变量
|
||||||
|
if (file_exists(WORKING_DIR . '/runtime/composer.phar')) {
|
||||||
|
echo '* Using native composer' . PHP_EOL;
|
||||||
|
putenv('COMPOSER_EXECUTABLE=' . WORKING_DIR . '/runtime/composer.phar');
|
||||||
|
}
|
||||||
$commands = [];
|
$commands = [];
|
||||||
foreach ($command_classes as $command_class) {
|
foreach ($command_classes as $command_class) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user