( stagingPath: string, installPath: string, )
| 371 | } |
| 372 | |
| 373 | async function installVersionFromBinary( |
| 374 | stagingPath: string, |
| 375 | installPath: string, |
| 376 | ) { |
| 377 | try { |
| 378 | // For direct binary downloads (GCS, generic bucket), the binary is directly in staging |
| 379 | const platform = getPlatform() |
| 380 | const binaryName = getBinaryName(platform) |
| 381 | const stagedBinaryPath = join(stagingPath, binaryName) |
| 382 | |
| 383 | try { |
| 384 | await stat(stagedBinaryPath) |
| 385 | } catch { |
| 386 | logEvent('ncode_native_install_binary_failure', { |
| 387 | stage_binary_exists: true, |
| 388 | error_binary_not_found: true, |
| 389 | }) |
| 390 | const error = new Error('Staged binary not found') |
| 391 | throw error |
| 392 | } |
| 393 | |
| 394 | await atomicMoveToInstallPath(stagedBinaryPath, installPath) |
| 395 | |
| 396 | // Clean up staging directory |
| 397 | await rm(stagingPath, { recursive: true, force: true }) |
| 398 | |
| 399 | logEvent('ncode_native_install_binary_success', {}) |
| 400 | } catch (error) { |
| 401 | if (!errorMessage(error).includes('Staged binary not found')) { |
| 402 | logEvent('ncode_native_install_binary_failure', { |
| 403 | stage_atomic_move: true, |
| 404 | error_move_failed: true, |
| 405 | }) |
| 406 | } |
| 407 | logError(toError(error)) |
| 408 | throw error |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | async function installVersion( |
| 413 | stagingPath: string, |
no test coverage detected