feat: delete
This commit is contained in:
@@ -498,9 +498,9 @@ class ChannelProjectService
|
||||
'php_uid' => $uid,
|
||||
'python' => $python,
|
||||
'python_is_abs' => $python !== '' && $python[0] === '/',
|
||||
'python_is_link' => $python !== '' && @is_link($python),
|
||||
'python_is_link' => $python !== '' && $this->pathIsLink($python),
|
||||
'python_is_file' => $python !== '' && @is_file($python),
|
||||
'python_link' => ($python !== '' && @is_link($python)) ? (string) @readlink($python) : null,
|
||||
'python_link' => $python !== '' ? ($this->symlinkTarget($python) ?: null) : null,
|
||||
'script' => $script,
|
||||
'script_exists' => $script !== '' && is_file($script),
|
||||
'path_env' => (string) (getenv('PATH') ?: ''),
|
||||
@@ -520,10 +520,10 @@ class ChannelProjectService
|
||||
$bits = ['exit 127 = 命令不存在'];
|
||||
if ($python === '' || $python === 'python3') {
|
||||
$bits[] = '未找到可用 python(.env CORUNA_CHANNEL_BUILDER_NEW_PYTHON 为空且无 .venv)';
|
||||
} elseif (! @is_file($python) && ! @is_link($python)) {
|
||||
} elseif (! @is_file($python) && ! $this->pathIsLink($python)) {
|
||||
$bits[] = '解释器路径不存在: '.$python;
|
||||
} else {
|
||||
$target = @is_link($python) ? (string) @readlink($python) : '';
|
||||
$target = $this->symlinkTarget($python);
|
||||
if ($target !== '') {
|
||||
$bits[] = 'venv python 软链指向 '.$target.'(目标机上可能没有这个 python)';
|
||||
}
|
||||
@@ -614,13 +614,28 @@ class ChannelProjectService
|
||||
clearstatcache(true, $path);
|
||||
|
||||
// is_link() checks the link inode inside the project; does not resolve target.
|
||||
if (@is_link($path)) {
|
||||
if ($this->pathIsLink($path)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return @is_file($path);
|
||||
}
|
||||
|
||||
private function pathIsLink(string $path): bool
|
||||
{
|
||||
return function_exists('is_link') && @is_link($path);
|
||||
}
|
||||
|
||||
private function symlinkTarget(string $path): string
|
||||
{
|
||||
if (! function_exists('readlink') || ! $this->pathIsLink($path)) {
|
||||
return '';
|
||||
}
|
||||
$target = @\readlink($path);
|
||||
|
||||
return is_string($target) ? $target : '';
|
||||
}
|
||||
|
||||
private function builderScript(string $name, string $builderType): string
|
||||
{
|
||||
$path = $this->builderCwd($builderType).'/tools/'.$name;
|
||||
|
||||
Reference in New Issue
Block a user