Skip to content

Commit 8b2bf91

Browse files
committed
Update local baseline script
1 parent 6c3c080 commit 8b2bf91

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

test/image/make_baseline.mjs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { spawn } from 'child_process';
1+
import { execFileSync, spawn } from 'child_process';
22
import { readFileSync } from 'fs';
33
import minimist from 'minimist';
44
import path from 'path';
@@ -61,15 +61,26 @@ if (mathjax3) allMockList = collections.mathjax3;
6161
if (allMockList.length) console.log(allMockList);
6262
console.log('Please wait for the process to complete.');
6363

64-
const p = spawn('python3', [
64+
let cmd;
65+
let args = [];
66+
try {
67+
execFileSync('uv', ['--version'], { stdio: 'ignore' });
68+
cmd = 'uv';
69+
args = ['run', 'python3'];
70+
} catch {
71+
cmd = 'python3';
72+
}
73+
const p = spawn(cmd, [
74+
...args,
6575
path.join('test', 'image', 'make_baseline.py'),
6676
`${mathjax3 ? 'mathjax3' : ''}${b64 ? 'b64' : ''}= ${allMockList.join(' ')}`
6777
]);
68-
try {
69-
p.stdout.on('data', (data) => {
70-
console.log(data.toString());
71-
});
72-
} catch (e) {
73-
console.error(e.stack);
74-
p.exit(1);
75-
}
78+
p.stdout.on('data', (data) => {
79+
process.stdout.write(data);
80+
});
81+
p.stderr.on('data', (data) => {
82+
process.stderr.write(data);
83+
});
84+
p.on('close', (code) => {
85+
if (code !== 0) process.exit(code);
86+
});

0 commit comments

Comments
 (0)