@@ -196,12 +196,14 @@ const startCli = (): boolean | Promise<void> => {
196
196
export class WrapperProcess {
197
197
private process ?: cp . ChildProcess ;
198
198
private started ?: Promise < void > ;
199
+ private currentVersion = product . codeServerVersion ;
199
200
200
201
public constructor ( ) {
201
202
ipcMain . onMessage ( async ( message ) => {
202
- switch ( message ) {
203
+ switch ( message . type ) {
203
204
case "relaunch" :
204
- logger . info ( "Relaunching..." ) ;
205
+ logger . info ( `Relaunching: ${ this . currentVersion } -> ${ message . version } ` ) ;
206
+ this . currentVersion = message . version ;
205
207
this . started = undefined ;
206
208
if ( this . process ) {
207
209
this . process . removeAllListeners ( ) ;
@@ -233,10 +235,16 @@ export class WrapperProcess {
233
235
}
234
236
235
237
private spawn ( ) : cp . ChildProcess {
236
- return cp . spawn ( process . argv [ 0 ] , process . argv . slice ( 1 ) , {
238
+ // If we're using loose files then we need to specify the path. If we're in
239
+ // the binary we need to let the binary determine the path (via nbin) since
240
+ // it could be different between binaries which presents a problem when
241
+ // upgrading (different version numbers or different staging directories).
242
+ const isBinary = ( global as any ) . NBIN_LOADED ;
243
+ return cp . spawn ( process . argv [ 0 ] , process . argv . slice ( isBinary ? 2 : 1 ) , {
237
244
env : {
238
245
...process . env ,
239
246
LAUNCH_VSCODE : "true" ,
247
+ NBIN_BYPASS : undefined ,
240
248
VSCODE_PARENT_PID : process . pid . toString ( ) ,
241
249
} ,
242
250
stdio : [ "inherit" , "inherit" , "inherit" , "ipc" ] ,
0 commit comments