/
nayvok
/
livecoding
Обзор
Документация
Войти
/
nayvok
/
livecoding
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
runner/src/executors/python.ts
31 строка
886 B
nayvok
fix: harden sessions and WebRTC recovery
17 июн 2026, 22:02
17 июн 2026, 22:02
37b9a92
Код
Авторство
О чём код?
import path from 'node:path' import { fileURLToPath } from 'node:url' import { executeChild } from './child.js' import type { RunResult } from '../types.js' export interface PythonExecutionConfig { command: string wrapperPath: string } export function getPythonExecutionConfig(): PythonExecutionConfig { const moduleDir = path.dirname(fileURLToPath(import.meta.url)) return { command: process.env.PYTHON_COMMAND ?? (process.platform === 'win32' ? 'python' : 'python3'), wrapperPath: process.env.PYTHON_WRAPPER_PATH ?? path.resolve(moduleDir, '..', '..', 'python_wrapper.py'), } } export function executePython(code: string, timeoutMs: number): Promise<RunResult> { const { command, wrapperPath } = getPythonExecutionConfig() return executeChild({ command, args: ['-I', wrapperPath], stdinPayload: code, timeoutMs, }) }