fix: harden repository refresh and server pull
ForgeFlow quality gate / quality (push) Canceled after 0s
ForgeFlow quality gate / quality (push) Canceled after 0s
This commit is contained in:
@@ -33,6 +33,10 @@ const {
|
||||
ExternalToolsService,
|
||||
} = require("./src/main/external-tools-service.cjs");
|
||||
const { registerIpc } = require("./src/main/ipc.cjs");
|
||||
const {
|
||||
installOutputPipeGuards,
|
||||
isBrokenPipeError,
|
||||
} = require("./src/main/process-error-policy.cjs");
|
||||
|
||||
let mainWindow;
|
||||
let repositoryMonitor;
|
||||
@@ -41,6 +45,14 @@ let diagnostics;
|
||||
let configStore;
|
||||
let tray;
|
||||
let quitCleanupStarted = false;
|
||||
const reportBrokenOutputPipe = (error) => {
|
||||
const report = diagnostics?.warning("process.output-pipe.closed", {
|
||||
code: error?.code || null,
|
||||
message: error?.message || "The parent output pipe was closed.",
|
||||
});
|
||||
report?.catch(() => {});
|
||||
};
|
||||
installOutputPipeGuards({ onBrokenPipe: reportBrokenOutputPipe });
|
||||
const ownsSingleInstanceLock = app.requestSingleInstanceLock();
|
||||
|
||||
if (!ownsSingleInstanceLock) app.quit();
|
||||
@@ -219,6 +231,10 @@ app
|
||||
await audit.initialize();
|
||||
|
||||
process.on("uncaughtException", (error) => {
|
||||
if (isBrokenPipeError(error)) {
|
||||
reportBrokenOutputPipe(error);
|
||||
return;
|
||||
}
|
||||
diagnostics
|
||||
?.error("process.uncaught-exception", error)
|
||||
.finally(() => app.exit(1));
|
||||
@@ -424,7 +440,6 @@ app
|
||||
});
|
||||
})
|
||||
.catch(async (error) => {
|
||||
console.error("[startup]", error);
|
||||
await diagnostics?.error("app.startup.failed", error);
|
||||
await diagnostics?.flush();
|
||||
app.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user