@@ -166,6 +166,28 @@ async function entry(): Promise<void> {
166166 console . log ( version , commit )
167167 }
168168 process . exit ( 0 )
169+ } else if ( args [ "list-extensions" ] || args [ "install-extension" ] || args [ "uninstall-extension" ] ) {
170+ logger . debug ( "forking vs code cli..." )
171+ const vscode = cp . fork ( path . resolve ( __dirname , "../../lib/vscode/out/vs/server/fork" ) , [ ] , {
172+ env : {
173+ ...process . env ,
174+ CODE_SERVER_PARENT_PID : process . pid . toString ( ) ,
175+ } ,
176+ } )
177+ vscode . once ( "message" , ( message : any ) => {
178+ logger . debug ( "Got message from VS Code" , field ( "message" , message ) )
179+ if ( message . type !== "ready" ) {
180+ logger . error ( "Unexpected response waiting for ready response" )
181+ process . exit ( 1 )
182+ }
183+ const send : CliMessage = { type : "cli" , args }
184+ vscode . send ( send )
185+ } )
186+ vscode . once ( "error" , ( error ) => {
187+ logger . error ( error . message )
188+ process . exit ( 1 )
189+ } )
190+ vscode . on ( "exit" , ( code ) => process . exit ( code || 0 ) )
169191 } else if ( process . env . VSCODE_IPC_HOOK_CLI ) {
170192 const pipeArgs : OpenCommandPipeArgs = {
171193 type : "open" ,
@@ -217,28 +239,6 @@ async function entry(): Promise<void> {
217239 } )
218240 vscode . write ( JSON . stringify ( pipeArgs ) )
219241 vscode . end ( )
220- } else if ( args [ "list-extensions" ] || args [ "install-extension" ] || args [ "uninstall-extension" ] ) {
221- logger . debug ( "forking vs code cli..." )
222- const vscode = cp . fork ( path . resolve ( __dirname , "../../lib/vscode/out/vs/server/fork" ) , [ ] , {
223- env : {
224- ...process . env ,
225- CODE_SERVER_PARENT_PID : process . pid . toString ( ) ,
226- } ,
227- } )
228- vscode . once ( "message" , ( message : any ) => {
229- logger . debug ( "Got message from VS Code" , field ( "message" , message ) )
230- if ( message . type !== "ready" ) {
231- logger . error ( "Unexpected response waiting for ready response" )
232- process . exit ( 1 )
233- }
234- const send : CliMessage = { type : "cli" , args }
235- vscode . send ( send )
236- } )
237- vscode . once ( "error" , ( error ) => {
238- logger . error ( error . message )
239- process . exit ( 1 )
240- } )
241- vscode . on ( "exit" , ( code ) => process . exit ( code || 0 ) )
242242 } else {
243243 wrap ( ( ) => main ( args , cliArgs , configArgs ) )
244244 }
0 commit comments