@@ -12,9 +12,10 @@ import * as semver from "semver";
1212import * as vscode from "vscode" ;
1313
1414import { errToStr } from "../api/api-helper" ;
15- import * as cli from "./cliUtils" ;
1615import { type Logger } from "../logging/logger" ;
1716import * as pgp from "../pgp" ;
17+
18+ import * as cliUtils from "./cliUtils" ;
1819import { type PathResolver } from "./pathResolver" ;
1920
2021export class CliManager {
@@ -58,16 +59,16 @@ export class CliManager {
5859 // downloads are disabled, we can return early.
5960 const binPath = path . join (
6061 this . pathResolver . getBinaryCachePath ( label ) ,
61- cli . name ( ) ,
62+ cliUtils . name ( ) ,
6263 ) ;
6364 this . output . info ( "Using binary path" , binPath ) ;
64- const stat = await cli . stat ( binPath ) ;
65+ const stat = await cliUtils . stat ( binPath ) ;
6566 if ( stat === undefined ) {
6667 this . output . info ( "No existing binary found, starting download" ) ;
6768 } else {
6869 this . output . info ( "Existing binary size is" , prettyBytes ( stat . size ) ) ;
6970 try {
70- const version = await cli . version ( binPath ) ;
71+ const version = await cliUtils . version ( binPath ) ;
7172 this . output . info ( "Existing binary version is" , version ) ;
7273 // If we have the right version we can avoid the request entirely.
7374 if ( version === buildInfo . version ) {
@@ -97,7 +98,7 @@ export class CliManager {
9798 }
9899
99100 // Remove any left-over old or temporary binaries and signatures.
100- const removed = await cli . rmOld ( binPath ) ;
101+ const removed = await cliUtils . rmOld ( binPath ) ;
101102 removed . forEach ( ( { fileName, error } ) => {
102103 if ( error ) {
103104 this . output . warn ( "Failed to remove" , fileName , error ) ;
@@ -107,7 +108,7 @@ export class CliManager {
107108 } ) ;
108109
109110 // Figure out where to get the binary.
110- const binName = cli . name ( ) ;
111+ const binName = cliUtils . name ( ) ;
111112 const configSource = cfg . get ( "binarySource" ) ;
112113 const binSource =
113114 configSource && String ( configSource ) . trim ( ) . length > 0
@@ -117,7 +118,7 @@ export class CliManager {
117118
118119 // Ideally we already caught that this was the right version and returned
119120 // 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 ) : "" ;
121122 this . output . info ( "Using ETag" , etag ) ;
122123
123124 // Download the binary to a temporary file.
@@ -173,14 +174,14 @@ export class CliManager {
173174 await fs . rename ( tempFile , binPath ) ;
174175
175176 // For debugging, to see if the binary only partially downloaded.
176- const newStat = await cli . stat ( binPath ) ;
177+ const newStat = await cliUtils . stat ( binPath ) ;
177178 this . output . info (
178179 "Downloaded binary size is" ,
179180 prettyBytes ( newStat ?. size || 0 ) ,
180181 ) ;
181182
182183 // Make sure we can execute this new binary.
183- const version = await cli . version ( binPath ) ;
184+ const version = await cliUtils . version ( binPath ) ;
184185 this . output . info ( "Downloaded binary version is" , version ) ;
185186
186187 return binPath ;
@@ -199,8 +200,8 @@ export class CliManager {
199200 if ( ! value ) {
200201 return ;
201202 }
202- const os = cli . goos ( ) ;
203- const arch = cli . goarch ( ) ;
203+ const os = cliUtils . goos ( ) ;
204+ const arch = cliUtils . goarch ( ) ;
204205 const params = new URLSearchParams ( {
205206 title : `Support the \`${ os } -${ arch } \` platform` ,
206207 body : `I'd like to use the \`${ os } -${ arch } \` architecture with the VS Code extension.` ,
@@ -223,7 +224,7 @@ export class CliManager {
223224 return ;
224225 }
225226 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 ( ) } \`` ,
227228 body : `Received status code \`${ status } \` when downloading the binary.` ,
228229 } ) ;
229230 const uri = vscode . Uri . parse (
0 commit comments