(command: string[])
| 753 | } |
| 754 | |
| 755 | const 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 |
no test coverage detected