reconfigure bundle tea binary (#514)

Co-authored-by: neil molina <neil@neils-MacBook-Pro.local>
This commit is contained in:
Neil 2023-04-27 14:42:52 +08:00 committed by GitHub
parent c4659fc91e
commit 8e443f1a66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,12 +31,18 @@ export async function initializeTeaCli(): Promise<string> {
const exists = fs.existsSync(cliBinPath);
if (exists) {
log.info("binary tea already exists at", cliBinPath);
binCheck = await asyncExec(`cd ${destinationDirectory} && ./tea --version`);
const teaVersion = binCheck.toString().split(" ")[1];
if (semverCompare(teaVersion, MINIMUM_TEA_VERSION) < 0) {
log.info("binary tea version is too old, updating");
try {
binCheck = await asyncExec(`cd ${destinationDirectory} && ./tea --version`);
const teaVersion = binCheck.toString().split(" ")[1];
if (semverCompare(teaVersion, MINIMUM_TEA_VERSION) < 0) {
log.info("binary tea version is too old, updating");
needsUpdate = true;
}
} catch (error) {
// probably binary is not executable or no permission
log.error("Error checking tea binary version:", error);
needsUpdate = true;
await asyncExec(`cd ${destinationDirectory} && rm tea`);
}
}