(
method: Extract<InstallMethod, { kind: 'bundle' }>,
pinned: string | undefined,
deps: UpgradeDeps
)
| 403 | } |
| 404 | |
| 405 | function upgradeUnixBundle( |
| 406 | method: Extract<InstallMethod, { kind: 'bundle' }>, |
| 407 | pinned: string | undefined, |
| 408 | deps: UpgradeDeps |
| 409 | ): number { |
| 410 | const downloader = deps.hasCommand('curl') |
| 411 | ? `curl -fsSL ${INSTALL_SH_URL}` |
| 412 | : deps.hasCommand('wget') |
| 413 | ? `wget -qO- ${INSTALL_SH_URL}` |
| 414 | : null; |
| 415 | if (!downloader) { |
| 416 | deps.error('Neither curl nor wget is available to download the installer.'); |
| 417 | deps.log(c.dim(`Install curl, or run manually: ${INSTALL_SH_URL} | sh`)); |
| 418 | return 1; |
| 419 | } |
| 420 | |
| 421 | const env: NodeJS.ProcessEnv = { ...process.env }; |
| 422 | if (method.installDir) env.CODEGRAPH_INSTALL_DIR = method.installDir; |
| 423 | if (pinned) env.CODEGRAPH_VERSION = pinned; |
| 424 | |
| 425 | deps.log(c.dim(`Running the installer (${downloader} | sh)…`)); |
| 426 | const code = deps.run('sh', ['-c', `${downloader} | sh`], env); |
| 427 | if (code !== 0) { |
| 428 | deps.error(`Installer exited with code ${code}.`); |
| 429 | return 1; |
| 430 | } |
| 431 | deps.log(''); |
| 432 | deps.log(c.green('✓ Upgrade complete.') + c.dim(' Open a new terminal if the version looks unchanged (PATH cache).')); |
| 433 | deps.log(reindexAdvisory()); |
| 434 | return 0; |
| 435 | } |
| 436 | |
| 437 | /** Build the in-place Windows upgrade script (exported for unit-testing). */ |
| 438 | export function buildWindowsUpgradeScript(bundleRoot: string, version: string, arch: string): string { |
no test coverage detected