Skip to content

Commit bf5b6ea

Browse files
ruromeroclaude
andcommitted
fix: use invokeCommand for Python version detection
Replace direct execSync call with the project's invokeCommand utility and getCustomPath to respect TRUSTIFY_DA_PYTHON3_PATH environment variable, consistent with other Python providers. Refs: TC-4316 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 132e2c2 commit bf5b6ea

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/providers/marker_evaluator.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
// "pywin32 ; sys_platform == 'win32'" is excluded on Linux/macOS.
44
// See https://peps.python.org/pep-0508/#environment-markers
55

6-
import { execSync } from 'node:child_process'
76
import os from 'node:os'
87

8+
import { getCustomPath, invokeCommand } from '../tools.js'
9+
910
let cachedPythonVersions = undefined
1011

1112
function getPythonVersions() {
1213
if (cachedPythonVersions !== undefined) { return cachedPythonVersions }
1314
try {
14-
let out = execSync('python3 -c "import sys; v=sys.version_info; print(f\'{v.major}.{v.minor} {v.major}.{v.minor}.{v.micro}\')"',
15-
{ timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'] }).toString().trim()
15+
let python = getCustomPath('python3')
16+
let out = invokeCommand(python, ['-c', "import sys; v=sys.version_info; print(f'{v.major}.{v.minor} {v.major}.{v.minor}.{v.micro}')"],
17+
{ timeout: 5000 }).toString().trim()
1618
let [short, full] = out.split(' ')
1719
cachedPythonVersions = { short, full }
1820
} catch {

0 commit comments

Comments
 (0)