From 2d90fd5c6b1c696f8a0119812d3b2fb084e2e4e2 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Fri, 31 Jul 2020 09:49:09 -0400 Subject: [PATCH] catch and log error from shell sync Signed-off-by: Sebastian Malton --- src/main/index.ts | 6 +++++- src/main/shell-sync.ts | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index f608490ed1..478992201d 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -30,7 +30,11 @@ if (app.commandLine.getSwitchValue("proxy-server") !== "") { } async function main() { - shellSync(app.getLocale()); + try { + await shellSync(app.getLocale()); + } catch (err) { + logger.warn("shellSync: ", err); + } const workingDir = path.join(app.getPath("appData"), appName); app.setName(appName); diff --git a/src/main/shell-sync.ts b/src/main/shell-sync.ts index 101fd46bc9..c7cf753e16 100644 --- a/src/main/shell-sync.ts +++ b/src/main/shell-sync.ts @@ -11,9 +11,10 @@ interface Env { * useful on macos where this always needs to be done. * @param locale Should be electron's `app.getLocale()` */ -export function shellSync(locale: string) { +export async function shellSync(locale: string) { const { shell } = os.userInfo(); - const env: Env = JSON.parse(JSON.stringify(shellEnv.sync(shell))) + + const env: Env = JSON.parse(JSON.stringify(await shellEnv(shell))) if (!env.LANG) { // the LANG env var expects an underscore instead of electron's dash env.LANG = `${locale.replace('-', '_')}.UTF-8`;