()
| 571 | } |
| 572 | |
| 573 | async function main() { |
| 574 | console.log('\x1b[1m\x1b[91m' + '='.repeat(60) + '\x1b[0m') |
| 575 | console.log('\x1b[1m\x1b[93m❄️ CODECANE STAGING ENVIRONMENT ❄️\x1b[0m') |
| 576 | console.log( |
| 577 | '\x1b[1m\x1b[91mFOR TESTING PURPOSES ONLY - NOT FOR PRODUCTION USE\x1b[0m', |
| 578 | ) |
| 579 | console.log('\x1b[1m\x1b[91m' + '='.repeat(60) + '\x1b[0m') |
| 580 | console.log('') |
| 581 | |
| 582 | await ensureBinaryExists() |
| 583 | |
| 584 | const child = spawn(CONFIG.binaryPath, process.argv.slice(2), { |
| 585 | stdio: 'inherit', |
| 586 | }) |
| 587 | |
| 588 | const exitListener = (code, signal) => { |
| 589 | resetTerminal({ |
| 590 | exitAlternateScreen: shouldExitAlternateScreen(code, signal), |
| 591 | }) |
| 592 | printCrashDiagnostics(code, signal) |
| 593 | process.exit(signal ? 1 : (code || 0)) |
| 594 | } |
| 595 | |
| 596 | child.on('exit', exitListener) |
| 597 | |
| 598 | child.on('error', (err) => { |
| 599 | console.error('Failed to start codecane:', err.message) |
| 600 | process.exit(1) |
| 601 | }) |
| 602 | |
| 603 | setTimeout(() => { |
| 604 | checkForUpdates(child, exitListener) |
| 605 | }, 100) |
| 606 | } |
| 607 | |
| 608 | main().catch((error) => { |
| 609 | console.error('❌ Unexpected error:', error.message) |
no test coverage detected