Skip to content

Commit 2e236ed

Browse files
committed
Update HyperfCommand.php
1 parent 799c234 commit 2e236ed

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/app/Command/HyperfCommand.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,18 @@ public function configure()
3838
public function handle()
3939
{
4040
$path = $this->config->getConfig('path.runtime', getenv('HOME') . '/.box');
41+
$kernel = strtolower($this->config->getConfig('kernel', 'swow'));
4142
$currentPhpVersion = $this->config->getConfig('versions.php', '8.1');
4243
$hyperfBin = $this->config->getConfig('hyperf.bin', './bin/hyperf.php');
43-
$bin = $path . '/php' . $currentPhpVersion . ' ' . $hyperfBin;
44+
if ($kernel === 'swoole') {
45+
$closeShortname = "-d swoole.use_shortname='Off'";
46+
$bin = $path . '/swoole-cli ' . $closeShortname . ' ' . $hyperfBin;
47+
if ($currentPhpVersion < '8.1') {
48+
$this->logger->warning(sprintf('Current setting PHP version is %s, but the kernel is Swoole and Swoole only support 8.1, so the PHP version is forced to 8.1.', $currentPhpVersion));
49+
}
50+
} else {
51+
$bin = $path . '/php' . $currentPhpVersion . ' ' . $hyperfBin;
52+
}
4453
$command = Str::replaceFirst('hyperf ', '', (string) $this->input);
4554
$fullCommand = sprintf('%s %s', $bin, $command);
4655
$this->liveCommand($fullCommand);

0 commit comments

Comments
 (0)