@@ -15,9 +15,6 @@ import { createUpdateURL, AbstractUpdateService } from 'vs/platform/update/elect
1515import { asJson } from 'vs/base/node/request' ;
1616import { shell } from 'electron' ;
1717import { CancellationToken } from 'vs/base/common/cancellation' ;
18- import * as path from 'vs/base/common/path' ;
19- import { spawn } from 'child_process' ;
20- import { realpath } from 'fs' ;
2118
2219export class LinuxUpdateService extends AbstractUpdateService {
2320
@@ -45,61 +42,36 @@ export class LinuxUpdateService extends AbstractUpdateService {
4542
4643 this . setState ( State . CheckingForUpdates ( context ) ) ;
4744
48- if ( process . env . SNAP && process . env . SNAP_REVISION ) {
49- this . checkForSnapUpdate ( ) ;
50- } else {
51- this . requestService . request ( { url : this . url } , CancellationToken . None )
52- . then < IUpdate > ( asJson )
53- . then ( update => {
54- if ( ! update || ! update . url || ! update . version || ! update . productVersion ) {
55- /* __GDPR__
56- "update:notAvailable" : {
57- "explicit" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
58- }
59- */
60- this . telemetryService . publicLog ( 'update:notAvailable' , { explicit : ! ! context } ) ;
61-
62- this . setState ( State . Idle ( UpdateType . Archive ) ) ;
63- } else {
64- this . setState ( State . AvailableForDownload ( update ) ) ;
65- }
66- } )
67- . then ( undefined , err => {
68- this . logService . error ( err ) ;
69-
45+ this . requestService . request ( { url : this . url } , CancellationToken . None )
46+ . then < IUpdate > ( asJson )
47+ . then ( update => {
48+ if ( ! update || ! update . url || ! update . version || ! update . productVersion ) {
7049 /* __GDPR__
71- "update:notAvailable" : {
72- "explicit" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
73- }
50+ "update:notAvailable" : {
51+ "explicit" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
52+ }
7453 */
7554 this . telemetryService . publicLog ( 'update:notAvailable' , { explicit : ! ! context } ) ;
7655
77- // only show message when explicitly checking for updates
78- const message : string | undefined = ! ! context ? ( err . message || err ) : undefined ;
79- this . setState ( State . Idle ( UpdateType . Archive , message ) ) ;
80- } ) ;
81- }
82- }
83-
84- private checkForSnapUpdate ( ) : void {
85- // If the application was installed as a snap, updates happen in the
86- // background automatically, we just need to check to see if an update
87- // has already happened.
88- realpath ( `${ path . dirname ( process . env . SNAP ! ) } /current` , ( err , resolvedCurrentSnapPath ) => {
89- if ( err ) {
90- this . logService . error ( 'update#checkForSnapUpdate(): Could not get realpath of application.' ) ;
91- return ;
92- }
93-
94- const currentRevision = path . basename ( resolvedCurrentSnapPath ) ;
56+ this . setState ( State . Idle ( UpdateType . Archive ) ) ;
57+ } else {
58+ this . setState ( State . AvailableForDownload ( update ) ) ;
59+ }
60+ } )
61+ . then ( undefined , err => {
62+ this . logService . error ( err ) ;
63+
64+ /* __GDPR__
65+ "update:notAvailable" : {
66+ "explicit" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
67+ }
68+ */
69+ this . telemetryService . publicLog ( 'update:notAvailable' , { explicit : ! ! context } ) ;
9570
96- if ( process . env . SNAP_REVISION !== currentRevision ) {
97- // TODO@joao : snap
98- this . setState ( State . Ready ( { version : '' , productVersion : '' } ) ) ;
99- } else {
100- this . setState ( State . Idle ( UpdateType . Archive ) ) ;
101- }
102- } ) ;
71+ // only show message when explicitly checking for updates
72+ const message : string | undefined = ! ! context ? ( err . message || err ) : undefined ;
73+ this . setState ( State . Idle ( UpdateType . Archive , message ) ) ;
74+ } ) ;
10375 }
10476
10577 protected async doDownloadUpdate ( state : AvailableForDownload ) : Promise < void > {
@@ -116,20 +88,5 @@ export class LinuxUpdateService extends AbstractUpdateService {
11688
11789 protected doQuitAndInstall ( ) : void {
11890 this . logService . trace ( 'update#quitAndInstall(): running raw#quitAndInstall()' ) ;
119-
120- const snap = process . env . SNAP ;
121-
122- // TODO@joao what to do?
123- if ( ! snap ) {
124- return ;
125- }
126-
127- // Allow 3 seconds for VS Code to close
128- spawn ( 'sleep 3 && $SNAP_NAME' , {
129- shell : true ,
130- detached : true ,
131- stdio : 'ignore' ,
132- } ) ;
133-
13491 }
13592}
0 commit comments