MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / spawnInstalledBinary

Function spawnInstalledBinary

cli/release/index.js:623–649  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

621}
622
623function spawnInstalledBinary(options = {}) {
624 if (!fs.existsSync(CONFIG.binaryPath)) {
625 try {
626 if (fs.existsSync(CONFIG.metadataPath)) fs.unlinkSync(CONFIG.metadataPath)
627 } catch {
628 // best effort
629 }
630 const error = new Error(
631 `downloaded binary is missing at ${CONFIG.binaryPath}`,
632 )
633 error.code = 'BINARY_MISSING'
634 printSpawnFailure(error)
635 process.exit(1)
636 }
637
638 const child = spawn(CONFIG.binaryPath, process.argv.slice(2), {
639 stdio: 'inherit',
640 ...options,
641 })
642
643 child.on('error', (err) => {
644 printSpawnFailure(err)
645 process.exit(1)
646 })
647
648 return child
649}
650
651async function main() {
652 await ensureBinaryExists()

Callers 2

checkForUpdatesFunction · 0.70
mainFunction · 0.70

Calls 2

printSpawnFailureFunction · 0.70
onMethod · 0.65

Tested by

no test coverage detected