()
| 436 | } |
| 437 | |
| 438 | async function ensureBinaryExists() { |
| 439 | const currentVersion = getCurrentVersion() |
| 440 | if (currentVersion !== null) { |
| 441 | return |
| 442 | } |
| 443 | |
| 444 | const version = await getLatestVersion() |
| 445 | if (!version) { |
| 446 | console.error('❌ Failed to determine latest version') |
| 447 | console.error('Please check your internet connection and try again') |
| 448 | if (!getProxyUrl()) { |
| 449 | console.error( |
| 450 | 'If you are behind a proxy, set the HTTPS_PROXY environment variable', |
| 451 | ) |
| 452 | } |
| 453 | process.exit(1) |
| 454 | } |
| 455 | |
| 456 | try { |
| 457 | await downloadBinary(version) |
| 458 | } catch (error) { |
| 459 | term.clearLine() |
| 460 | console.error('❌ Failed to download freebuff:', error.message) |
| 461 | console.error('Please check your internet connection and try again') |
| 462 | if (!getProxyUrl()) { |
| 463 | console.error( |
| 464 | 'If you are behind a proxy, set the HTTPS_PROXY environment variable', |
| 465 | ) |
| 466 | } |
| 467 | process.exit(1) |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | async function checkForUpdates(runningProcess, exitListener) { |
| 472 | try { |
no test coverage detected