Add R2 persistence and manual conflict repair

This commit is contained in:
lezi-fun committed 2026-08-13 22:42:43 +08:00
1 parent 2d50da41cd
commit e8ee698fa4
19 files changed
+1258 -62

No files matched your search

+34 -1
View File
@@ -492,7 +492,7 @@ async function runCommandAllowFailure(
return new Promise((resolve, reject) => {
const child = spawn(command, args, {
cwd,
env: { ...process.env, ...extraEnv },
env: buildCommandEnvironment(extraEnv),
stdio: ["ignore", "pipe", "pipe"]
});
let stdout = "";
@@ -503,3 +503,36 @@ async function runCommandAllowFailure(
child.on("close", (code) => resolve({ code: code ?? 1, stdout, stderr }));
});
}
function buildCommandEnvironment(extraEnv: Record<string, string>): NodeJS.ProcessEnv {
const env: NodeJS.ProcessEnv = {};
for (const key of [
"PATH",
"USER",
"SHELL",
"TMPDIR",
"TMP",
"TEMP",
"LANG",
"LC_ALL",
"CI",
"HTTP_PROXY",
"HTTPS_PROXY",
"NO_PROXY",
"http_proxy",
"https_proxy",
"no_proxy",
"ALL_PROXY",
"all_proxy",
"NODE_EXTRA_CA_CERTS",
"SSL_CERT_FILE",
"SSL_CERT_DIR"
]) {
const value = process.env[key];
if (value !== undefined) {
env[key] = value;
}
}
Object.assign(env, extraEnv);
return env;
}