mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
fix(test): stabilize core runtime infra shard
This commit is contained in:
@@ -98,6 +98,9 @@ function getColorForConsole(): ChalkInstance {
|
||||
typeof process.env.FORCE_COLOR === "string" &&
|
||||
process.env.FORCE_COLOR.trim().length > 0 &&
|
||||
process.env.FORCE_COLOR.trim() !== "0";
|
||||
if (hasForceColor) {
|
||||
return new Chalk({ level: 1 });
|
||||
}
|
||||
if (process.env.NO_COLOR && !hasForceColor) {
|
||||
return new Chalk({ level: 0 });
|
||||
}
|
||||
|
||||
@@ -12,8 +12,17 @@ import {
|
||||
|
||||
async function writeSecureFile(filePath: string, content: string, mode = 0o600): Promise<void> {
|
||||
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
||||
await fs.writeFile(filePath, content, "utf8");
|
||||
await fs.chmod(filePath, mode);
|
||||
const tempPath = `${filePath}.tmp-${process.pid}-${Date.now()}-${Math.random()
|
||||
.toString(16)
|
||||
.slice(2)}`;
|
||||
try {
|
||||
await fs.writeFile(tempPath, content, "utf8");
|
||||
await fs.chmod(tempPath, mode);
|
||||
await fs.rename(tempPath, filePath);
|
||||
} catch (err) {
|
||||
await fs.rm(tempPath, { force: true }).catch(() => {});
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
describe("secret ref resolver", () => {
|
||||
|
||||
Reference in New Issue
Block a user