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

Function spawnInstalledBinary

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

Source from the content-addressed store, hash-verified

608}
609
610function spawnInstalledBinary(options = {}) {
611 if (!fs.existsSync(CONFIG.binaryPath)) {
612 try {
613 if (fs.existsSync(CONFIG.metadataPath)) fs.unlinkSync(CONFIG.metadataPath)
614 } catch {
615 // best effort
616 }
617 const error = new Error(
618 `downloaded binary is missing at ${CONFIG.binaryPath}`,
619 )
620 error.code = 'BINARY_MISSING'
621 printSpawnFailure(error)
622 process.exit(1)
623 }
624
625 const child = spawn(CONFIG.binaryPath, process.argv.slice(2), {
626 stdio: 'inherit',
627 ...options,
628 })
629
630 child.on('error', (err) => {
631 printSpawnFailure(err)
632 process.exit(1)
633 })
634
635 return child
636}
637
638async function main() {
639 await ensureBinaryExists()

Callers 2

checkForUpdatesFunction · 0.70
mainFunction · 0.70

Calls 2

printSpawnFailureFunction · 0.70
onMethod · 0.65

Tested by

no test coverage detected