@@ -166,6 +166,28 @@ async function entry(): Promise<void> {
166
166
console . log ( version , commit )
167
167
}
168
168
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 ) )
169
191
} else if ( process . env . VSCODE_IPC_HOOK_CLI ) {
170
192
const pipeArgs : OpenCommandPipeArgs = {
171
193
type : "open" ,
@@ -217,28 +239,6 @@ async function entry(): Promise<void> {
217
239
} )
218
240
vscode . write ( JSON . stringify ( pipeArgs ) )
219
241
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 ) )
242
242
} else {
243
243
wrap ( ( ) => main ( args , cliArgs , configArgs ) )
244
244
}
0 commit comments