@@ -8,6 +8,7 @@ import * as fs from 'fs';
88import * as os from 'os' ;
99import { spawn } from 'child_process' ;
1010import uri from 'vs/base/common/uri' ;
11+ import { assign } from 'vs/base/common/objects' ;
1112
1213const rootPath = path . dirname ( uri . parse ( require . toUrl ( '' ) ) . fsPath ) ;
1314const packageJsonPath = path . join ( rootPath , 'package.json' ) ;
@@ -49,27 +50,28 @@ ${ indent }-w, --wait Wait for the window to be closed before returni
4950
5051export function main ( argv : string [ ] ) {
5152 const argParser = new ArgParser ( argv ) ;
52- let exit = true ;
5353
5454 if ( argParser . hasFlag ( 'help' , 'h' ) ) {
5555 console . log ( argParser . help ( ) ) ;
5656 } else if ( argParser . hasFlag ( 'version' , 'v' ) ) {
5757 console . log ( packageJson . version ) ;
5858 } else {
59- delete process . env [ 'ATOM_SHELL_INTERNAL_RUN_AS_NODE' ] ;
60- if ( argParser . hasFlag ( 'wait' , 'w' ) ) {
61- exit = false ;
59+ const env = assign ( { } , process . env ) ;
60+ delete env [ 'ATOM_SHELL_INTERNAL_RUN_AS_NODE' ] ;
61+
62+ const child = spawn ( process . execPath , process . argv . slice ( 2 ) , {
63+ detached : true ,
64+ stdio : 'ignore' ,
65+ env
66+ } ) ;
6267
63- let child = spawn ( process . execPath , process . argv . slice ( 2 ) , { detached : true , stdio : 'ignore' } ) ;
68+ if ( argParser . hasFlag ( 'wait' , 'w' ) ) {
6469 child . on ( 'exit' , process . exit ) ;
65- } else {
66- spawn ( process . execPath , process . argv . slice ( 2 ) , { detached : true , stdio : 'ignore' } ) ;
70+ return ;
6771 }
6872 }
6973
70- if ( exit ) {
71- process . exit ( 0 ) ;
72- }
74+ process . exit ( 0 ) ;
7375}
7476
7577main ( process . argv . slice ( 2 ) ) ;
0 commit comments