mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:10:42 +00:00
fix(scripts): guard core test tsgo in sparse worktrees
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
applyLocalTsgoPolicy,
|
||||
shouldAcquireLocalHeavyCheckLockForTsgo,
|
||||
} from "./lib/local-heavy-check-runtime.mjs";
|
||||
import { getSparseTsgoGuardError } from "./lib/tsgo-sparse-guard.mjs";
|
||||
|
||||
const { args: finalArgs, env } = applyLocalTsgoPolicy(process.argv.slice(2), process.env);
|
||||
|
||||
@@ -14,26 +15,33 @@ const tsBuildInfoFile = readFlagValue(finalArgs, "--tsBuildInfoFile");
|
||||
if (tsBuildInfoFile) {
|
||||
fs.mkdirSync(path.dirname(path.resolve(tsBuildInfoFile)), { recursive: true });
|
||||
}
|
||||
const releaseLock = shouldAcquireLocalHeavyCheckLockForTsgo(finalArgs, env)
|
||||
? acquireLocalHeavyCheckLockSync({
|
||||
cwd: process.cwd(),
|
||||
env,
|
||||
toolName: "tsgo",
|
||||
})
|
||||
: () => {};
|
||||
const sparseGuardError = getSparseTsgoGuardError(finalArgs, { cwd: process.cwd() });
|
||||
const releaseLock =
|
||||
sparseGuardError || !shouldAcquireLocalHeavyCheckLockForTsgo(finalArgs, env)
|
||||
? () => {}
|
||||
: acquireLocalHeavyCheckLockSync({
|
||||
cwd: process.cwd(),
|
||||
env,
|
||||
toolName: "tsgo",
|
||||
});
|
||||
|
||||
try {
|
||||
const result = spawnSync(tsgoPath, finalArgs, {
|
||||
stdio: "inherit",
|
||||
env,
|
||||
shell: process.platform === "win32",
|
||||
});
|
||||
if (sparseGuardError) {
|
||||
console.error(sparseGuardError);
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
const result = spawnSync(tsgoPath, finalArgs, {
|
||||
stdio: "inherit",
|
||||
env,
|
||||
shell: process.platform === "win32",
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
throw result.error;
|
||||
if (result.error) {
|
||||
throw result.error;
|
||||
}
|
||||
|
||||
process.exitCode = result.status ?? 1;
|
||||
}
|
||||
|
||||
process.exitCode = result.status ?? 1;
|
||||
} finally {
|
||||
releaseLock();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user