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

Function installBinaries

evals/buffbench/run-buffbench.ts:269–311  ·  view source on GitHub ↗

* Install binaries specified in binInstalls config to a temporary directory * Returns the temporary directory path and updated env with PATH

(binInstalls: EvalDataV2['binInstalls'])

Source from the content-addressed store, hash-verified

267 * Returns the temporary directory path and updated env with PATH
268 */
269function installBinaries(binInstalls: EvalDataV2['binInstalls']): {
270 tempDir: string | null
271 env: Record<string, string>
272} {
273 if (!binInstalls || binInstalls.length === 0) {
274 return { tempDir: null, env: {} }
275 }
276
277 const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'codebuff-bins-'))
278
279 const binPaths: string[] = []
280
281 for (const bin of binInstalls) {
282 try {
283 execSync(bin.installScript, {
284 cwd: tempDir,
285 stdio: 'ignore',
286 env: { ...process.env, INSTALL_DIR: tempDir },
287 })
288
289 const fullBinPath = path.join(tempDir, bin.binPath)
290 if (fs.existsSync(fullBinPath)) {
291 binPaths.push(path.dirname(fullBinPath))
292 console.log(`✓ ${bin.name} installed at ${fullBinPath}`)
293 } else {
294 console.warn(
295 `Warning: Expected binary not found at ${fullBinPath} after installing ${bin.name}`,
296 )
297 }
298 } catch (error) {
299 console.error(`Error installing ${bin.name}:`, error)
300 throw error
301 }
302 }
303
304 // Prepend all bin paths to PATH
305 const updatedPath = [...binPaths, process.env.PATH].filter(Boolean).join(':')
306
307 return {
308 tempDir,
309 env: { PATH: updatedPath },
310 }
311}
312
313interface CommitWithSource {
314 commit: EvalCommitV2

Callers 1

runBuffBenchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected