UNPKG

@comake/skl-js-engine

Version:

Standard Knowledge Language Javascript Engine

21 lines (19 loc) 686 B
import type { ChildProcess } from 'node:child_process'; import { spawn } from 'node:child_process'; import { EXECUTION_CONSTANTS } from './constants'; import { ProcessSpawnError } from './errors'; /** * Spawns a Deno process with the given arguments * @param commandArgs - Command line arguments for Deno * @returns The spawned child process * @throws ProcessSpawnError if the process fails to spawn */ export function spawnDenoProcess(commandArgs: string[]): ChildProcess { try { return spawn(EXECUTION_CONSTANTS.denoCommand, commandArgs, { stdio: [ 'pipe', 'pipe', 'pipe' ] }); } catch (error: unknown) { throw new ProcessSpawnError(error as Error); } }