|
|
@@ -15,7 +15,7 @@
|
|
|
|
|
|
const fs = require('fs');
|
|
|
const path = require('path');
|
|
|
-const { execSync } = require('child_process');
|
|
|
+const { execFileSync } = require('child_process');
|
|
|
|
|
|
function extractDotBlocks(markdown) {
|
|
|
const blocks = [];
|
|
|
@@ -69,7 +69,7 @@ ${bodies.join('\n\n')}
|
|
|
|
|
|
function renderToSvg(dotContent) {
|
|
|
try {
|
|
|
- return execSync('dot -Tsvg', {
|
|
|
+ return execFileSync('dot', ['-Tsvg'], {
|
|
|
input: dotContent,
|
|
|
encoding: 'utf-8',
|
|
|
maxBuffer: 10 * 1024 * 1024
|
|
|
@@ -107,9 +107,10 @@ function main() {
|
|
|
process.exit(1);
|
|
|
}
|
|
|
|
|
|
- // Check if dot is available
|
|
|
+ // Check if dot is available. Run the binary directly rather than probing
|
|
|
+ // with `which`, which is not a command on Windows.
|
|
|
try {
|
|
|
- execSync('which dot', { encoding: 'utf-8' });
|
|
|
+ execFileSync('dot', ['-V'], { stdio: 'ignore' });
|
|
|
} catch {
|
|
|
console.error('Error: graphviz (dot) not found. Install with:');
|
|
|
console.error(' brew install graphviz # macOS');
|