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

Function runSystemCommand

cli/src/utils/theme-system.ts:755–778  ·  view source on GitHub ↗
(command: string[])

Source from the content-addressed store, hash-verified

753}
754
755const runSystemCommand = (command: string[]): string | null => {
756 if (typeof Bun === 'undefined') return null
757 if (command.length === 0) return null
758
759 const [binary] = command
760 if (!binary) return null
761
762 const resolvedBinary =
763 Bun.which(binary) ??
764 (process.platform === 'win32' ? Bun.which(`${binary}.exe`) : null)
765 if (!resolvedBinary) return null
766
767 try {
768 const result = Bun.spawnSync({
769 cmd: [resolvedBinary, ...command.slice(1)],
770 stdout: 'pipe',
771 stderr: 'pipe',
772 })
773 if (result.exitCode !== 0) return null
774 return readSpawnOutput(result.stdout)
775 } catch {
776 return null
777 }
778}
779
780/**
781 * Detect Windows PowerShell background color theme

Callers 2

detectPlatformThemeFunction · 0.85

Calls 1

readSpawnOutputFunction · 0.85

Tested by

no test coverage detected