@@ -159,28 +159,30 @@ function createWindow(settings) {
159
159
signale . watch ( "Waiting for frontend connection..." ) ;
160
160
}
161
161
162
- app . on ( 'ready' , ( ) => {
162
+ app . on ( 'ready' , async ( ) => {
163
163
signale . pending ( `Loading settings file...` ) ;
164
164
let settings = require ( settingsFile ) ;
165
165
signale . success ( `Settings loaded!` ) ;
166
166
167
167
if ( ! require ( "fs" ) . existsSync ( settings . cwd ) ) throw new Error ( "Configured cwd path does not exist." ) ;
168
168
169
- let customEnv ;
170
-
171
169
// 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
+ } ) ;
176
178
177
179
signale . pending ( `Creating new terminal process on port ${ settings . port || '3000' } ` ) ;
178
180
tty = new Terminal ( {
179
181
role : "server" ,
180
182
shell : settings . shell . split ( " " ) [ 0 ] ,
181
183
params : settings . shell . split ( " " ) . splice ( 1 ) ,
182
184
cwd : settings . cwd ,
183
- env : customEnv || settings . env ,
185
+ env : cleanEnv ,
184
186
port : settings . port || 3000
185
187
} ) ;
186
188
signale . success ( `Terminal back-end initialized!` ) ;
@@ -235,7 +237,7 @@ app.on('ready', () => {
235
237
shell : settings . shell . split ( " " ) [ 0 ] ,
236
238
params : settings . shell . split ( " " ) . splice ( 1 ) ,
237
239
cwd : tty . tty . _cwd || settings . cwd ,
238
- env : customEnv || settings . env ,
240
+ env : cleanEnv ,
239
241
port : port
240
242
} ) ;
241
243
signale . success ( `New terminal back-end initialized at ${ port } ` ) ;
0 commit comments