@@ -196,12 +196,14 @@ const startCli = (): boolean | Promise<void> => {
196196export class WrapperProcess {
197197 private process ?: cp . ChildProcess ;
198198 private started ?: Promise < void > ;
199+ private currentVersion = product . codeServerVersion ;
199200
200201 public constructor ( ) {
201202 ipcMain . onMessage ( async ( message ) => {
202- switch ( message ) {
203+ switch ( message . type ) {
203204 case "relaunch" :
204- logger . info ( "Relaunching..." ) ;
205+ logger . info ( `Relaunching: ${ this . currentVersion } -> ${ message . version } ` ) ;
206+ this . currentVersion = message . version ;
205207 this . started = undefined ;
206208 if ( this . process ) {
207209 this . process . removeAllListeners ( ) ;
@@ -233,10 +235,16 @@ export class WrapperProcess {
233235 }
234236
235237 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 ) , {
237244 env : {
238245 ...process . env ,
239246 LAUNCH_VSCODE : "true" ,
247+ NBIN_BYPASS : undefined ,
240248 VSCODE_PARENT_PID : process . pid . toString ( ) ,
241249 } ,
242250 stdio : [ "inherit" , "inherit" , "inherit" , "ipc" ] ,
0 commit comments