This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { spawnSync } from 'node:child_process'
|
||||
|
||||
const candidates =
|
||||
process.platform === 'win32'
|
||||
? [
|
||||
['py', ['-3']],
|
||||
['python3', []],
|
||||
['python', []],
|
||||
]
|
||||
: [
|
||||
['python3', []],
|
||||
['python', []],
|
||||
]
|
||||
|
||||
for (const [command, prefix] of candidates) {
|
||||
const result = spawnSync(command, [...prefix, ...process.argv.slice(2)], {
|
||||
stdio: 'inherit',
|
||||
})
|
||||
if (result.error?.code === 'ENOENT') continue
|
||||
process.exit(result.status ?? 1)
|
||||
}
|
||||
|
||||
console.error('Python 3 was not found. Install Python 3 and retry.')
|
||||
process.exit(1)
|
||||
Reference in New Issue
Block a user