git updater: Fix macOS (#391)

Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
Dominik 2023-01-13 23:24:51 +01:00 committed by GitHub
parent 32cdb63885
commit 6329499b1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@ node_modules
vencord_installer
.idea
.DS_Store
yarn.lock
package-lock.json

View File

@ -30,6 +30,8 @@ const execFile = promisify(cpExecFile);
const isFlatpak = Boolean(process.env.FLATPAK_ID?.includes("discordapp") || process.env.FLATPAK_ID?.includes("Discord"));
if (process.platform === "darwin") process.env.PATH = `/usr/local/bin:${process.env.PATH}`;
function git(...args: string[]) {
const opts = { cwd: VENCORD_SRC_DIR };
@ -66,10 +68,10 @@ async function pull() {
async function build() {
const opts = { cwd: VENCORD_SRC_DIR };
let res;
const command = isFlatpak ? "flatpak-spawn" : "node";
const args = isFlatpak ? ["--host", "node", "scripts/build/build.mjs"] : ["scripts/build/build.mjs"];
if (isFlatpak) res = await execFile("flatpak-spawn", ["--host", "node", "scripts/build/build.mjs"], opts);
else res = await execFile("node", ["scripts/build/build.mjs"], opts);
const res = await execFile(command, args, opts);
return !res.stderr.includes("Build failed");
}