Add support for package environment variables and path injection

This commit is contained in:
crazywhalecc
2026-03-20 09:30:34 +08:00
parent beeb0b8721
commit b0522205da
3 changed files with 45 additions and 0 deletions

View File

@@ -112,6 +112,17 @@ class GlobalEnvManager
}
}
public static function appendEnv(string $key, string $value): void
{
$existing = getenv($key);
if ($existing !== false && $existing !== '') {
$separator = SystemTarget::isUnix() ? ':' : ';';
self::putenv("{$key}={$value}{$separator}{$existing}");
} else {
self::putenv("{$key}={$value}");
}
}
/**
* Initialize the toolchain after the environment variables are set.
* The toolchain or environment availability check is done here.