From dfab53d1881b6b02f01f38c032b8737b61f185cf Mon Sep 17 00:00:00 2001 From: creations Date: Mon, 15 Dec 2025 19:08:15 -0500 Subject: [PATCH] move updater to fsync so its fully committed to disk before relaunching (#565) --- src/main/updater/http.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/updater/http.ts b/src/main/updater/http.ts index 827a26571..0985a8cf7 100644 --- a/src/main/updater/http.ts +++ b/src/main/updater/http.ts @@ -20,7 +20,7 @@ import { fetchBuffer, fetchJson } from "@main/utils/http"; import { IpcEvents } from "@shared/IpcEvents"; import { VENCORD_USER_AGENT } from "@shared/vencordUserAgent"; import { ipcMain } from "electron"; -import { writeFileSync as originalWriteFileSync } from "original-fs"; +import { closeSync, fsyncSync, openSync, writeFileSync as originalWriteFileSync } from "original-fs"; import gitHash from "~git-hash"; import gitRemote from "~git-remote"; @@ -74,6 +74,10 @@ async function applyUpdates() { const data = await fetchBuffer(PendingUpdate); originalWriteFileSync(__dirname, data); + const fd = openSync(__dirname, "r"); + fsyncSync(fd); + closeSync(fd); + PendingUpdate = null; return true;