@@ -269,7 +269,7 @@ interface IEnv {
269269 [ key : string ] : string ;
270270}
271271
272- function getUnixUserEnvironment ( ) : TPromise < IEnv > {
272+ function getUnixShellEnvironment ( ) : TPromise < IEnv > {
273273 const promise = new TPromise ( ( c , e ) => {
274274 const runAsNode = process . env [ 'ATOM_SHELL_INTERNAL_RUN_AS_NODE' ] ;
275275 const noAttach = process . env [ 'ELECTRON_NO_ATTACH_CONSOLE' ] ;
@@ -328,53 +328,50 @@ function getUnixUserEnvironment(): TPromise<IEnv> {
328328}
329329
330330/**
331- * On Unix systems, we might need to get the environment
332- * from a user's shell. This should only be done when Code
333- * is not launched from a Terminal .
331+ * We eed to get the environment from a user's shell.
332+ * This should only be done when Code itself is not launched
333+ * from within a shell .
334334 */
335- function getUserShellEnvironment ( ) : TPromise < IEnv > {
336- if ( platform . isWindows ) {
335+ function getShellEnvironment ( ) : TPromise < IEnv > {
336+ if ( process . env [ 'VSCODE_CLI' ] === '1' ) {
337337 return TPromise . as ( { } ) ;
338338 }
339339
340- if ( process . env [ 'VSCODE_CLI' ] === '1' ) {
340+ if ( platform . isWindows ) {
341341 return TPromise . as ( { } ) ;
342342 }
343343
344- return getUnixUserEnvironment ( ) ;
344+ return getUnixShellEnvironment ( ) ;
345345}
346346
347347/**
348348 * Returns the user environment necessary for all Code processes.
349349 * Such environment needs to be propagated to the renderer/shared
350350 * processes.
351351 */
352- function getUserEnvironment ( ) : TPromise < IEnv > {
353- return getUserShellEnvironment ( ) . then ( userShellEnv => {
352+ function getEnvironment ( ) : TPromise < IEnv > {
353+ return getShellEnvironment ( ) . then ( shellEnv => {
354354 return instantiationService . invokeFunction ( a => {
355355 const envService = a . get ( IEnvironmentService ) ;
356356 const instanceEnv = {
357357 VSCODE_PID : String ( process . pid ) ,
358358 VSCODE_IPC_HOOK : envService . mainIPCHandle ,
359- VSCODE_SHARED_IPC_HOOK : envService . sharedIPCHandle
359+ VSCODE_SHARED_IPC_HOOK : envService . sharedIPCHandle ,
360+ VSCODE_NLS_CONFIG : process . env [ 'VSCODE_NLS_CONFIG' ]
360361 } ;
361362
362- return assign ( { } , userShellEnv , instanceEnv ) ;
363+ return assign ( { } , shellEnv , instanceEnv ) ;
363364 } ) ;
364365 } ) ;
365366}
366367
367368// On some platforms we need to manually read from the global environment variables
368369// and assign them to the process environment (e.g. when doubleclick app on Mac)
369- getUserEnvironment ( ) . then ( userEnv => {
370- assign ( process . env , userEnv ) ;
371-
372- // Make sure the NLS Config travels to the rendered process
373- // See also https://github.com/Microsoft/vscode/issues/4558
374- userEnv [ 'VSCODE_NLS_CONFIG' ] = process . env [ 'VSCODE_NLS_CONFIG' ] ;
370+ getEnvironment ( ) . then ( env => {
371+ assign ( process . env , env ) ;
375372
376373 return instantiationService . invokeFunction ( a => a . get ( IEnvironmentService ) . createPaths ( ) )
377374 . then ( ( ) => instantiationService . invokeFunction ( setupIPC ) )
378- . then ( ipcServer => instantiationService . invokeFunction ( main , ipcServer , userEnv ) ) ;
375+ . then ( ipcServer => instantiationService . invokeFunction ( main , ipcServer , env ) ) ;
379376} )
380377. done ( null , err => instantiationService . invokeFunction ( quit , err ) ) ;
0 commit comments