From 4aebd6a0876ec92ec98d75a93cad19a8d1f2aeba Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Thu, 19 Feb 2026 19:51:39 -0800 Subject: [PATCH] ensure app data directory exists before spawning process --- src/server/apps.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/apps.ts b/src/server/apps.ts index 96eee00..b19fee1 100644 --- a/src/server/apps.ts +++ b/src/server/apps.ts @@ -644,9 +644,12 @@ async function runApp(dir: string, port: number) { // Load env vars from TOES_DIR/env/ const appEnv = loadAppEnv(dir, TOES_DIR) + const dataDir = join(process.env.DATA_DIR ?? '.', 'toes', dir) + mkdirSync(dataDir, { recursive: true }) + const proc = Bun.spawn(['bun', 'run', 'toes'], { cwd, - env: { ...process.env, ...appEnv, PORT: String(port), NO_AUTOPORT: 'true', APP_URL: buildAppUrl(dir, TOES_URL), APPS_DIR, DATA_DIR: join(process.env.DATA_DIR ?? '.', 'toes', dir), TOES_DIR, TOES_URL }, + env: { ...process.env, ...appEnv, PORT: String(port), NO_AUTOPORT: 'true', APP_URL: buildAppUrl(dir, TOES_URL), APPS_DIR, DATA_DIR: dataDir, TOES_DIR, TOES_URL }, stdout: 'pipe', stderr: 'pipe', })