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

Function runTreeSitterSmoke

cli/scripts/smoke-binary.ts:84–115  ·  view source on GitHub ↗
(binary: string)

Source from the content-addressed store, hash-verified

82const DEFAULT_RUN_SECONDS = 10
83
84function runTreeSitterSmoke(binary: string): Promise<void> {
85 return new Promise((resolve, reject) => {
86 const proc = spawn(binary, ['--smoke-tree-sitter'], {
87 stdio: ['ignore', 'pipe', 'pipe'],
88 env: { ...process.env, NO_COLOR: '1', TERM: 'dumb' },
89 })
90
91 let captured = ''
92 const append = (chunk: Buffer): void => {
93 captured += chunk.toString('utf8')
94 }
95 proc.stdout?.on('data', append)
96 proc.stderr?.on('data', append)
97
98 proc.once('error', reject)
99 proc.once('exit', (code) => {
100 if (code === 0 && /tree-sitter smoke ok/.test(captured)) {
101 resolve()
102 return
103 }
104
105 reject(
106 new Error(
107 `tree-sitter smoke failed with exit code ${code}\n${captured.slice(
108 0,
109 8 * 1024,
110 )}`,
111 ),
112 )
113 })
114 })
115}
116
117async function main(): Promise<void> {
118 const binary = process.argv[2]

Callers 1

mainFunction · 0.85

Calls 3

onceMethod · 0.80
onMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected