()
| 7 | import { conda } from "../utils/conda"; |
| 8 | |
| 9 | async function start() { |
| 10 | const { PIP_PATH, PYTHON_PATH, CONDA_SCRIPTS_PATH, CONDA_ENV_PATH } = conda.getCondaPaths(); |
| 11 | |
| 12 | try { |
| 13 | logger.info("start "); |
| 14 | const repoPath = getComfyUIDir(); |
| 15 | const shell = isWindows ? 'cmd' : '/bin/bash'; |
| 16 | const command = PYTHON_PATH; |
| 17 | const args = ['main.py', '--enable-cors-header']; |
| 18 | |
| 19 | const proc = spawn(command, args, { |
| 20 | cwd: repoPath, |
| 21 | env: { |
| 22 | PATH: getSystemPath({ |
| 23 | CONDA_SCRIPTS_PATH, |
| 24 | CONDA_ENV_PATH |
| 25 | }) |
| 26 | }, |
| 27 | shell |
| 28 | }); |
| 29 | |
| 30 | proc.stdout.on('data', (data) => { |
| 31 | logger.info(`stdout: ${data}`); |
| 32 | }); |
| 33 | |
| 34 | proc.stderr.on('data', (data) => { |
| 35 | console.error(`stderr: ${data}`); |
| 36 | }); |
| 37 | |
| 38 | proc.on('close', (code) => { |
| 39 | logger.info(`child process exited with code ${code}`); |
| 40 | }); |
| 41 | |
| 42 | } catch (err: any) { |
| 43 | throw new Error(`Start ComfyUI error: ${err.message}`); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | start(); |
no test coverage detected