()
| 448 | } |
| 449 | |
| 450 | async function ensureBinaryExists() { |
| 451 | const currentVersion = getCurrentVersion() |
| 452 | if (currentVersion !== null) { |
| 453 | return |
| 454 | } |
| 455 | |
| 456 | const version = await getLatestVersion() |
| 457 | if (!version) { |
| 458 | console.error('❌ Failed to determine latest version') |
| 459 | console.error('Please check your internet connection and try again') |
| 460 | if (!getProxyUrl()) { |
| 461 | console.error( |
| 462 | 'If you are behind a proxy, set the HTTPS_PROXY environment variable', |
| 463 | ) |
| 464 | } |
| 465 | process.exit(1) |
| 466 | } |
| 467 | |
| 468 | try { |
| 469 | await downloadBinary(version) |
| 470 | } catch (error) { |
| 471 | term.clearLine() |
| 472 | console.error('❌ Failed to download codebuff:', error.message) |
| 473 | console.error('Please check your internet connection and try again') |
| 474 | if (!getProxyUrl()) { |
| 475 | console.error( |
| 476 | 'If you are behind a proxy, set the HTTPS_PROXY environment variable', |
| 477 | ) |
| 478 | } |
| 479 | process.exit(1) |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | async function checkForUpdates(runningProcess, exitListener) { |
| 484 | try { |
no test coverage detected