fix built-in composer not working with init command

This commit is contained in:
crazywhalecc
2023-02-12 19:26:19 +08:00
committed by Jerry
parent fe332eb8f2
commit f63923a792
2 changed files with 12 additions and 2 deletions

View File

@@ -72,9 +72,14 @@ class InitCommand extends Command
}
$section->writeln('<info>完成</info>');
$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>');
});