From 7dcd41e59820e5c6c00830bbea8ad729ffea4e99 Mon Sep 17 00:00:00 2001 From: Tasos Boulis Date: Mon, 6 Feb 2023 16:36:35 +0200 Subject: [PATCH] Exit process with code 1 if afterPack throws error (#2541) --- .vscode/settings.json | 1 + scripts/afterpack.js | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index d932621c..13e1d666 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,6 +6,7 @@ "source.fixAll.eslint": true }, "cSpell.words": [ + "appimage", "automations", "Autoupgrade", "browserview", diff --git a/scripts/afterpack.js b/scripts/afterpack.js index c55294f5..21b69ea2 100644 --- a/scripts/afterpack.js +++ b/scripts/afterpack.js @@ -37,14 +37,20 @@ function getAppFileName(context) { } exports.default = async function afterPack(context) { - await flipFuses( - `${context.appOutDir}/${getAppFileName(context)}`, // Returns the path to the electron binary - { - version: FuseVersion.V1, - [FuseV1Options.RunAsNode]: false, // Disables ELECTRON_RUN_AS_NODE - }); + try { + await flipFuses( + `${context.appOutDir}/${getAppFileName(context)}`, // Returns the path to the electron binary + { + version: FuseVersion.V1, + [FuseV1Options.RunAsNode]: false, // Disables ELECTRON_RUN_AS_NODE + }); - if (context.electronPlatformName === 'linux') { - context.targets.forEach(fixSetuid(context)); + if (context.electronPlatformName === 'linux') { + context.targets.forEach(fixSetuid(context)); + } + } catch (error) { + console.error('afterPack error: ', error); + // eslint-disable-next-line no-process-exit + process.exit(1); } };