@@ -159,28 +159,30 @@ function createWindow(settings) {
159159 signale . watch ( "Waiting for frontend connection..." ) ;
160160}
161161
162- app . on ( 'ready' , ( ) => {
162+ app . on ( 'ready' , async ( ) => {
163163 signale . pending ( `Loading settings file...` ) ;
164164 let settings = require ( settingsFile ) ;
165165 signale . success ( `Settings loaded!` ) ;
166166
167167 if ( ! require ( "fs" ) . existsSync ( settings . cwd ) ) throw new Error ( "Configured cwd path does not exist." ) ;
168168
169- let customEnv ;
170-
171169 // See #366
172- if ( process . platform === "darwin" ) {
173- const shellEnv = require ( "shell-env" ) ;
174- customEnv = shellEnv . sync ( ) ;
175- }
170+ let cleanEnv = await require ( "shell-env" ) ( settings . shell ) . catch ( e => { throw e ; } ) ;
171+
172+ Object . assign ( cleanEnv , process . env , settings . env , {
173+ TERM : "xterm-256color" ,
174+ COLORTERM : "truecolor" ,
175+ TERM_PROGRAM : "eDEX-UI" ,
176+ TERM_PROGRAM_VERSION : app . getVersion ( )
177+ } ) ;
176178
177179 signale . pending ( `Creating new terminal process on port ${ settings . port || '3000' } ` ) ;
178180 tty = new Terminal ( {
179181 role : "server" ,
180182 shell : settings . shell . split ( " " ) [ 0 ] ,
181183 params : settings . shell . split ( " " ) . splice ( 1 ) ,
182184 cwd : settings . cwd ,
183- env : customEnv || settings . env ,
185+ env : cleanEnv ,
184186 port : settings . port || 3000
185187 } ) ;
186188 signale . success ( `Terminal back-end initialized!` ) ;
@@ -235,7 +237,7 @@ app.on('ready', () => {
235237 shell : settings . shell . split ( " " ) [ 0 ] ,
236238 params : settings . shell . split ( " " ) . splice ( 1 ) ,
237239 cwd : tty . tty . _cwd || settings . cwd ,
238- env : customEnv || settings . env ,
240+ env : cleanEnv ,
239241 port : port
240242 } ) ;
241243 signale . success ( `New terminal back-end initialized at ${ port } ` ) ;
0 commit comments