From ec9e1ba2bb26a66bd4ce8f4c2938a50344b0ff66 Mon Sep 17 00:00:00 2001 From: Krish De Souza Date: Tue, 4 Dec 2018 23:44:01 +0000 Subject: [PATCH 1/2] Snap update fixes in updateService.snap.ts - Fixed isUpdateAvailable in updateService.snap.ts to correctly identify snap version - Also fixed a small typo in doCheckForUpdates - Removed check in function doQuitAndInstall --- .../update/electron-main/updateService.snap.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/vs/platform/update/electron-main/updateService.snap.ts b/src/vs/platform/update/electron-main/updateService.snap.ts index c15b406e587..1f2049d847f 100644 --- a/src/vs/platform/update/electron-main/updateService.snap.ts +++ b/src/vs/platform/update/electron-main/updateService.snap.ts @@ -164,7 +164,7 @@ export class SnapUpdateService extends AbstractUpdateService2 { this.isUpdateAvailable().then(result => { if (result) { - this.setState(State.Ready({ version: 'something', productVersion: 'someting' })); + this.setState(State.Ready({ version: 'something', productVersion: 'something' })); } else { /* __GDPR__ "update:notAvailable" : { @@ -191,12 +191,8 @@ export class SnapUpdateService extends AbstractUpdateService2 { protected doQuitAndInstall(): void { this.logService.trace('update#quitAndInstall(): running raw#quitAndInstall()'); - if (typeof process.env.SNAP === 'undefined') { - return; - } - // Allow 3 seconds for VS Code to close - spawn('bash', ['-c', path.join(process.env.SNAP, `usr/share/${product.applicationName}/snapUpdate.sh`)], { + spawn('bash', ['-c', path.join(process.env.SNAP!, `usr/share/${product.applicationName}/snapUpdate.sh`)], { detached: true, stdio: ['ignore', 'ignore', 'ignore'] }); @@ -204,7 +200,7 @@ export class SnapUpdateService extends AbstractUpdateService2 { private isUpdateAvailable(): Thenable { return new Promise((c, e) => { - realpath(`/snap/${product.applicationName}/current`, (err, resolvedCurrentSnapPath) => { + realpath(`${path.dirname(process.env.SNAP!)}/current`, (err, resolvedCurrentSnapPath) => { if (err) { return e(err); } const currentRevision = path.basename(resolvedCurrentSnapPath); From d37f1c01ec222032c8c3e65d2b1477656b05202c Mon Sep 17 00:00:00 2001 From: Krish De Souza Date: Thu, 6 Dec 2018 11:36:36 +0000 Subject: [PATCH 2/2] Fixed snapUpdate.sh to use environment variable to spawn a new instance of vscode. --- resources/linux/snap/snapUpdate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/linux/snap/snapUpdate.sh b/resources/linux/snap/snapUpdate.sh index d9299ca4d58..77569bfc16a 100755 --- a/resources/linux/snap/snapUpdate.sh +++ b/resources/linux/snap/snapUpdate.sh @@ -1,3 +1,3 @@ #!/bin/sh sleep 2 -@@NAME@@ \ No newline at end of file +$SNAP_NAME \ No newline at end of file