diff --git a/src/container-runner.ts b/src/container-runner.ts index 3c6c783..fb3d7ab 100644 --- a/src/container-runner.ts +++ b/src/container-runner.ts @@ -5,6 +5,7 @@ import { spawn } from 'child_process'; import fs from 'fs'; +import os from 'os'; import path from 'path'; import pino from 'pino'; import { @@ -20,6 +21,14 @@ const logger = pino({ transport: { target: 'pino-pretty', options: { colorize: true } } }); +function getHomeDir(): string { + const home = process.env.HOME || os.homedir(); + if (!home) { + throw new Error('Unable to determine home directory: HOME environment variable is not set and os.homedir() returned empty'); + } + return home; +} + export interface ContainerInput { prompt: string; sessionId?: string; @@ -44,7 +53,7 @@ interface VolumeMount { function buildVolumeMounts(group: RegisteredGroup, isMain: boolean): VolumeMount[] { const mounts: VolumeMount[] = []; - const homeDir = process.env.HOME || '/Users/gavriel'; + const homeDir = getHomeDir(); const projectRoot = process.cwd(); if (isMain) {