Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot Autofix powered by AI
parent
157a2c7a4a
commit
68062afc4f
@@ -413,6 +413,19 @@ export async function startBuildProcess(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hasWinres) {
|
if (hasWinres) {
|
||||||
|
const agentDir = path.join(clientDir, "cmd", "agent");
|
||||||
|
const winresLockPath = path.join(agentDir, ".winres.lock");
|
||||||
|
|
||||||
|
if (fs.existsSync(winresLockPath)) {
|
||||||
|
sendToStream({
|
||||||
|
type: "output",
|
||||||
|
text: "WARNING: Another build is currently generating Windows resources for this client. Skipping winres for this build.\n",
|
||||||
|
level: "warn",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Acquire a simple lock so only one build at a time touches cmd/agent/*.syso
|
||||||
|
fs.writeFileSync(winresLockPath, String(process.pid));
|
||||||
|
try {
|
||||||
sendToStream({ type: "output", text: `Using go-winres: ${winresBin}\n`, level: "info" });
|
sendToStream({ type: "output", text: `Using go-winres: ${winresBin}\n`, level: "info" });
|
||||||
winresTempDir = path.join(outDir, `.winres-${buildId.substring(0, 8)}`);
|
winresTempDir = path.join(outDir, `.winres-${buildId.substring(0, 8)}`);
|
||||||
fs.mkdirSync(winresTempDir, { recursive: true });
|
fs.mkdirSync(winresTempDir, { recursive: true });
|
||||||
@@ -460,14 +473,13 @@ export async function startBuildProcess(
|
|||||||
fs.writeFileSync(winresJsonPath, JSON.stringify(winresConfig, null, 2));
|
fs.writeFileSync(winresJsonPath, JSON.stringify(winresConfig, null, 2));
|
||||||
sendToStream({ type: "output", text: `Winres config: ${winresJsonPath}\n`, level: "info" });
|
sendToStream({ type: "output", text: `Winres config: ${winresJsonPath}\n`, level: "info" });
|
||||||
|
|
||||||
const sysoOutPrefix = path.join(clientDir, "cmd", "agent", "rsrc");
|
const sysoOutPrefix = path.join(agentDir, "rsrc");
|
||||||
try {
|
try {
|
||||||
const winresResult = await $`${winresBin} make --in ${winresJsonPath} --out ${sysoOutPrefix}`.cwd(winresTempDir).nothrow().quiet();
|
const winresResult = await $`${winresBin} make --in ${winresJsonPath} --out ${sysoOutPrefix}`.cwd(winresTempDir).nothrow().quiet();
|
||||||
if (winresResult.exitCode !== 0) {
|
if (winresResult.exitCode !== 0) {
|
||||||
const stderr = winresResult.stderr.toString().trim();
|
const stderr = winresResult.stderr.toString().trim();
|
||||||
sendToStream({ type: "output", text: `WARNING: go-winres failed (exit ${winresResult.exitCode}): ${stderr}\nBuilding without assembly data.\n`, level: "warn" });
|
sendToStream({ type: "output", text: `WARNING: go-winres failed (exit ${winresResult.exitCode}): ${stderr}\nBuilding without assembly data.\n`, level: "warn" });
|
||||||
} else {
|
} else {
|
||||||
const agentDir = path.join(clientDir, "cmd", "agent");
|
|
||||||
for (const f of fs.readdirSync(agentDir)) {
|
for (const f of fs.readdirSync(agentDir)) {
|
||||||
if (f.startsWith("rsrc") && f.endsWith(".syso")) {
|
if (f.startsWith("rsrc") && f.endsWith(".syso")) {
|
||||||
generatedSysoFiles.push(path.join(agentDir, f));
|
generatedSysoFiles.push(path.join(agentDir, f));
|
||||||
@@ -478,6 +490,14 @@ export async function startBuildProcess(
|
|||||||
} catch (winresErr: any) {
|
} catch (winresErr: any) {
|
||||||
sendToStream({ type: "output", text: `WARNING: go-winres failed: ${winresErr.message || winresErr}. Building without assembly data.\n`, level: "warn" });
|
sendToStream({ type: "output", text: `WARNING: go-winres failed: ${winresErr.message || winresErr}. Building without assembly data.\n`, level: "warn" });
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
fs.unlinkSync(winresLockPath);
|
||||||
|
} catch {
|
||||||
|
// ignore errors removing the lock
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user