@@ -404,6 +404,17 @@ export async function main(argv: string[]): Promise<any> {
404
404
}
405
405
}
406
406
407
+ for ( const e in env ) {
408
+ // Ignore the _ env var, because the open command
409
+ // ignores it anyway.
410
+ // Pass the rest of the env vars in to fix
411
+ // https://github.com/microsoft/vscode/issues/134696.
412
+ if ( e !== '_' ) {
413
+ spawnArgs . push ( '--env' ) ;
414
+ spawnArgs . push ( `${ e } =${ env [ e ] } ` ) ;
415
+ }
416
+ }
417
+
407
418
spawnArgs . push ( '--args' , ...argv . slice ( 2 ) ) ; // pass on our arguments
408
419
409
420
if ( env [ 'VSCODE_DEV' ] ) {
@@ -412,10 +423,23 @@ export async function main(argv: string[]): Promise<any> {
412
423
// it needs the full vscode source arg to launch properly.
413
424
const curdir = '.' ;
414
425
const launchDirIndex = spawnArgs . indexOf ( curdir ) ;
415
- spawnArgs [ launchDirIndex ] = resolve ( curdir ) ;
426
+ if ( launchDirIndex !== - 1 ) {
427
+ spawnArgs [ launchDirIndex ] = resolve ( curdir ) ;
428
+ }
416
429
}
417
430
418
- child = spawn ( 'open' , spawnArgs , options ) ;
431
+ // Keep just the _ env var here,
432
+ // because it's still needed to open Code,
433
+ // even though the open command doesn't understand it.
434
+ const truncatedOptions = {
435
+ detached : options . detached ,
436
+ stdio : options [ 'stdio' ] ,
437
+ env : {
438
+ '_' : options . env ?. [ '_' ]
439
+ }
440
+ } ;
441
+
442
+ child = spawn ( 'open' , spawnArgs , truncatedOptions ) ;
419
443
}
420
444
421
445
return Promise . all ( processCallbacks . map ( callback => callback ( child ) ) ) ;
0 commit comments