ensure app data directory exists before spawning process

This commit is contained in:
Chris Wanstrath 2026-02-19 19:51:39 -08:00
parent 36c7913b6c
commit 4aebd6a087

View File

@ -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',
})