@@ -12,9 +12,10 @@ import * as semver from "semver";
12
12
import * as vscode from "vscode" ;
13
13
14
14
import { errToStr } from "../api/api-helper" ;
15
- import * as cli from "./cliUtils" ;
16
15
import { type Logger } from "../logging/logger" ;
17
16
import * as pgp from "../pgp" ;
17
+
18
+ import * as cliUtils from "./cliUtils" ;
18
19
import { type PathResolver } from "./pathResolver" ;
19
20
20
21
export class CliManager {
@@ -58,16 +59,16 @@ export class CliManager {
58
59
// downloads are disabled, we can return early.
59
60
const binPath = path . join (
60
61
this . pathResolver . getBinaryCachePath ( label ) ,
61
- cli . name ( ) ,
62
+ cliUtils . name ( ) ,
62
63
) ;
63
64
this . output . info ( "Using binary path" , binPath ) ;
64
- const stat = await cli . stat ( binPath ) ;
65
+ const stat = await cliUtils . stat ( binPath ) ;
65
66
if ( stat === undefined ) {
66
67
this . output . info ( "No existing binary found, starting download" ) ;
67
68
} else {
68
69
this . output . info ( "Existing binary size is" , prettyBytes ( stat . size ) ) ;
69
70
try {
70
- const version = await cli . version ( binPath ) ;
71
+ const version = await cliUtils . version ( binPath ) ;
71
72
this . output . info ( "Existing binary version is" , version ) ;
72
73
// If we have the right version we can avoid the request entirely.
73
74
if ( version === buildInfo . version ) {
@@ -97,7 +98,7 @@ export class CliManager {
97
98
}
98
99
99
100
// Remove any left-over old or temporary binaries and signatures.
100
- const removed = await cli . rmOld ( binPath ) ;
101
+ const removed = await cliUtils . rmOld ( binPath ) ;
101
102
removed . forEach ( ( { fileName, error } ) => {
102
103
if ( error ) {
103
104
this . output . warn ( "Failed to remove" , fileName , error ) ;
@@ -107,7 +108,7 @@ export class CliManager {
107
108
} ) ;
108
109
109
110
// Figure out where to get the binary.
110
- const binName = cli . name ( ) ;
111
+ const binName = cliUtils . name ( ) ;
111
112
const configSource = cfg . get ( "binarySource" ) ;
112
113
const binSource =
113
114
configSource && String ( configSource ) . trim ( ) . length > 0
@@ -117,7 +118,7 @@ export class CliManager {
117
118
118
119
// Ideally we already caught that this was the right version and returned
119
120
// early, but just in case set the ETag.
120
- const etag = stat !== undefined ? await cli . eTag ( binPath ) : "" ;
121
+ const etag = stat !== undefined ? await cliUtils . eTag ( binPath ) : "" ;
121
122
this . output . info ( "Using ETag" , etag ) ;
122
123
123
124
// Download the binary to a temporary file.
@@ -173,14 +174,14 @@ export class CliManager {
173
174
await fs . rename ( tempFile , binPath ) ;
174
175
175
176
// For debugging, to see if the binary only partially downloaded.
176
- const newStat = await cli . stat ( binPath ) ;
177
+ const newStat = await cliUtils . stat ( binPath ) ;
177
178
this . output . info (
178
179
"Downloaded binary size is" ,
179
180
prettyBytes ( newStat ?. size || 0 ) ,
180
181
) ;
181
182
182
183
// Make sure we can execute this new binary.
183
- const version = await cli . version ( binPath ) ;
184
+ const version = await cliUtils . version ( binPath ) ;
184
185
this . output . info ( "Downloaded binary version is" , version ) ;
185
186
186
187
return binPath ;
@@ -199,8 +200,8 @@ export class CliManager {
199
200
if ( ! value ) {
200
201
return ;
201
202
}
202
- const os = cli . goos ( ) ;
203
- const arch = cli . goarch ( ) ;
203
+ const os = cliUtils . goos ( ) ;
204
+ const arch = cliUtils . goarch ( ) ;
204
205
const params = new URLSearchParams ( {
205
206
title : `Support the \`${ os } -${ arch } \` platform` ,
206
207
body : `I'd like to use the \`${ os } -${ arch } \` architecture with the VS Code extension.` ,
@@ -223,7 +224,7 @@ export class CliManager {
223
224
return ;
224
225
}
225
226
const params = new URLSearchParams ( {
226
- title : `Failed to download binary on \`${ cli . goos ( ) } -${ cli . goarch ( ) } \`` ,
227
+ title : `Failed to download binary on \`${ cliUtils . goos ( ) } -${ cliUtils . goarch ( ) } \`` ,
227
228
body : `Received status code \`${ status } \` when downloading the binary.` ,
228
229
} ) ;
229
230
const uri = vscode . Uri . parse (
0 commit comments