( stagingPath: string, installPath: string, )
| 383 | } |
| 384 | |
| 385 | async function installVersionFromBinary( |
| 386 | stagingPath: string, |
| 387 | installPath: string, |
| 388 | ) { |
| 389 | try { |
| 390 | // For direct binary downloads (GCS, generic bucket), the binary is directly in staging |
| 391 | const platform = getPlatform() |
| 392 | const binaryName = getBinaryName(platform) |
| 393 | const stagedBinaryPath = join(stagingPath, binaryName) |
| 394 | |
| 395 | try { |
| 396 | await stat(stagedBinaryPath) |
| 397 | } catch { |
| 398 | logEvent('tengu_native_install_binary_failure', { |
| 399 | stage_binary_exists: true, |
| 400 | error_binary_not_found: true, |
| 401 | }) |
| 402 | const error = new Error('Staged binary not found') |
| 403 | throw error |
| 404 | } |
| 405 | |
| 406 | await atomicMoveToInstallPath(stagedBinaryPath, installPath) |
| 407 | |
| 408 | // Clean up staging directory |
| 409 | await rm(stagingPath, { recursive: true, force: true }) |
| 410 | |
| 411 | logEvent('tengu_native_install_binary_success', {}) |
| 412 | } catch (error) { |
| 413 | if (!errorMessage(error).includes('Staged binary not found')) { |
| 414 | logEvent('tengu_native_install_binary_failure', { |
| 415 | stage_atomic_move: true, |
| 416 | error_move_failed: true, |
| 417 | }) |
| 418 | } |
| 419 | logError(toError(error)) |
| 420 | throw error |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | async function installVersion( |
| 425 | stagingPath: string, |
no test coverage detected