test(delivery-gate): select an interpreter only if it runs Python 3

Signed-off-by: Wen <jwcastillo@gmail.com>
(cherry picked from commit fe861f8983)
This commit is contained in:
Wen authored and haelyra committed 2026-10-20 18:01:41 -04:00
1 parent 936cf3d040
commit 6839f58cd3
1 file changed
+3 -1
@@ -22,8 +22,10 @@ function findPython() {
{ command: 'py', args: ['-3'] },
].filter(candidate => candidate.command);
// Probe for Python 3 itself: a Python 2 `--version` also exits 0, but the
// driver below needs importlib.util.
for (const candidate of candidates) {
const result = spawnSync(candidate.command, [...candidate.args, '--version'], {
const result = spawnSync(candidate.command, [...candidate.args, '-c', 'import sys; sys.exit(sys.version_info[0] != 3)'], {
encoding: 'utf8',
timeout: 5000,
});