Merge pull request #7 from gavrielc/claude/fix-home-directory-fallback-FF5Tr
Fix hardcoded home directory fallback in container runner
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
import { spawn } from 'child_process';
|
import { spawn } from 'child_process';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import pino from 'pino';
|
import pino from 'pino';
|
||||||
import {
|
import {
|
||||||
@@ -20,6 +21,14 @@ const logger = pino({
|
|||||||
transport: { target: 'pino-pretty', options: { colorize: true } }
|
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 {
|
export interface ContainerInput {
|
||||||
prompt: string;
|
prompt: string;
|
||||||
sessionId?: string;
|
sessionId?: string;
|
||||||
@@ -44,7 +53,7 @@ interface VolumeMount {
|
|||||||
|
|
||||||
function buildVolumeMounts(group: RegisteredGroup, isMain: boolean): VolumeMount[] {
|
function buildVolumeMounts(group: RegisteredGroup, isMain: boolean): VolumeMount[] {
|
||||||
const mounts: VolumeMount[] = [];
|
const mounts: VolumeMount[] = [];
|
||||||
const homeDir = process.env.HOME || '/Users/gavriel';
|
const homeDir = getHomeDir();
|
||||||
const projectRoot = process.cwd();
|
const projectRoot = process.cwd();
|
||||||
|
|
||||||
if (isMain) {
|
if (isMain) {
|
||||||
|
|||||||
Reference in New Issue
Block a user