File tree Expand file tree Collapse file tree 2 files changed +50
-46
lines changed
Expand file tree Collapse file tree 2 files changed +50
-46
lines changed Original file line number Diff line number Diff line change @@ -325,22 +325,24 @@ async function downloadBinary(version) {
325325}
326326
327327async function ensureBinaryExists ( ) {
328- if ( ! fs . existsSync ( CONFIG . binaryPath ) ) {
329- const version = await getLatestVersion ( )
330- if ( ! version ) {
331- console . error ( '❌ Failed to determine latest version' )
332- console . error ( 'Please check your internet connection and try again' )
333- process . exit ( 1 )
334- }
328+ if ( await getCurrentVersion ( ) !== null ) {
329+ return
330+ }
335331
336- try {
337- await downloadBinary ( version )
338- } catch ( error ) {
339- term . clearLine ( )
340- console . error ( '❌ Failed to download codebuff:' , error . message )
341- console . error ( 'Please check your internet connection and try again' )
342- process . exit ( 1 )
343- }
332+ const version = await getLatestVersion ( )
333+ if ( ! version ) {
334+ console . error ( '❌ Failed to determine latest version' )
335+ console . error ( 'Please check your internet connection and try again' )
336+ process . exit ( 1 )
337+ }
338+
339+ try {
340+ await downloadBinary ( version )
341+ } catch ( error ) {
342+ term . clearLine ( )
343+ console . error ( '❌ Failed to download codebuff:' , error . message )
344+ console . error ( 'Please check your internet connection and try again' )
345+ process . exit ( 1 )
344346 }
345347}
346348
Original file line number Diff line number Diff line change @@ -298,40 +298,42 @@ async function downloadBinary(version) {
298298}
299299
300300async function ensureBinaryExists ( ) {
301- if ( ! fs . existsSync ( CONFIG . binaryPath ) ) {
302- const version = await getLatestVersion ( )
303- if ( ! version ) {
304- if ( isPrintMode ) {
305- console . error (
306- JSON . stringify ( {
307- type : 'error' ,
308- message : 'Failed to determine latest version.' ,
309- } ) ,
310- )
311- } else {
312- console . error ( '❌ Failed to determine latest version' )
313- console . error ( 'Please check your internet connection and try again' )
314- }
315- process . exit ( 1 )
301+ if ( ( await getCurrentVersion ( ) ) !== null ) {
302+ return
303+ }
304+
305+ const version = await getLatestVersion ( )
306+ if ( ! version ) {
307+ if ( isPrintMode ) {
308+ console . error (
309+ JSON . stringify ( {
310+ type : 'error' ,
311+ message : 'Failed to determine latest version.' ,
312+ } ) ,
313+ )
314+ } else {
315+ console . error ( '❌ Failed to determine latest version' )
316+ console . error ( 'Please check your internet connection and try again' )
316317 }
318+ process . exit ( 1 )
319+ }
317320
318- try {
319- await downloadBinary ( version )
320- } catch ( error ) {
321- term . clearLine ( )
322- if ( isPrintMode ) {
323- console . error (
324- JSON . stringify ( {
325- type : 'error' ,
326- message : `Failed to download codebuff: ${ error . message } ` ,
327- } ) ,
328- )
329- } else {
330- console . error ( '❌ Failed to download codebuff:' , error . message )
331- console . error ( 'Please check your internet connection and try again' )
332- }
333- process . exit ( 1 )
321+ try {
322+ await downloadBinary ( version )
323+ } catch ( error ) {
324+ term . clearLine ( )
325+ if ( isPrintMode ) {
326+ console . error (
327+ JSON . stringify ( {
328+ type : 'error' ,
329+ message : `Failed to download codebuff: ${ error . message } ` ,
330+ } ) ,
331+ )
332+ } else {
333+ console . error ( '❌ Failed to download codebuff:' , error . message )
334+ console . error ( 'Please check your internet connection and try again' )
334335 }
336+ process . exit ( 1 )
335337 }
336338}
337339
You can’t perform that action at this time.
0 commit comments