Download apps/server/src/lib/exec-utils.ts from lekmikdok/hyp: direct link, hf CLI and curl.
- Browser
- Download file 849 Bytes
-
https://huggingface.co/spaces/lekmikdok/hyp/resolve/main/apps/server/src/lib/exec-utils.ts
- Command line
-
hf download hf://spaces/lekmikdok/hyp/apps/server/src/lib/exec-utils.ts
-
curl -L -o exec-utils.ts https://huggingface.co/spaces/lekmikdok/hyp/resolve/main/apps/server/src/lib/exec-utils.ts
849 Bytes
| /** | |
| * Shared execution utilities | |
| * | |
| * Common helpers for spawning child processes with the correct environment. | |
| * Used by both route handlers and service layers. | |
| */ | |
| import { createLogger } from '@automaker/utils'; | |
| const logger = createLogger('ExecUtils'); | |
| // Extended PATH to include common tool installation locations | |
| export const extendedPath = [ | |
| process.env.PATH, | |
| '/opt/homebrew/bin', | |
| '/usr/local/bin', | |
| '/home/linuxbrew/.linuxbrew/bin', | |
| `${process.env.HOME}/.local/bin`, | |
| ] | |
| .filter(Boolean) | |
| .join(':'); | |
| export const execEnv = { | |
| ...process.env, | |
| PATH: extendedPath, | |
| }; | |
| export function getErrorMessage(error: unknown): string { | |
| if (error instanceof Error) { | |
| return error.message; | |
| } | |
| return String(error); | |
| } | |
| export function logError(error: unknown, context: string): void { | |
| logger.error(`${context}:`, error); | |
| } | |