From d759f6039b68f9cb2f1b8fbabe62635b579505fc Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Tue, 24 Nov 2015 12:11:44 -0800 Subject: [PATCH] fix(boot): Copy env from main process into renderer process on linux See: https://github.com/atom/electron/issues/3306 This was casuing NYLAS_HOME to be unavailable on the renderer process --- static/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/static/index.js b/static/index.js index 55c4a4d2f..329cf7cfc 100644 --- a/static/index.js +++ b/static/index.js @@ -21,7 +21,21 @@ function handleSetupError (error) { console.error(error.stack || error) } +function copyEnvFromMainProcess() { + var _ = require('underscore'); + var remote = require('remote'); + var newEnv = _.extend({}, process.env, remote.process.env); + process.env = newEnv; +} + function setupWindow (loadSettings) { + if (process.platform === 'linux') { + // This will properly inherit process.env from the main process, which it + // doesn't do by default on Linux. See: + // https://github.com/atom/electron/issues/3306 + copyEnvFromMainProcess(); + } + var hotreload = loadSettings.devMode && !loadSettings.isSpec; var CompileCache = require('../src/compile-cache') CompileCache.setHotReload(hotreload)