Compare commits

...

1 Commits

Author SHA1 Message Date
Aiden Cline ace18c7de0 fix(tui): forward environment to worker 2026-07-08 14:56:49 +00:00
2 changed files with 11 additions and 1 deletions
+5 -1
View File
@@ -207,7 +207,11 @@ export const TuiThreadCommand = cmd({
}
const cwd = Filesystem.resolve(process.cwd())
const worker = new Worker(file)
const worker = new Worker(file, {
env: Object.fromEntries(
Object.entries(process.env).filter((entry): entry is [string, string] => entry[1] !== undefined),
),
})
const client = Rpc.client<typeof rpc>(worker)
const reload = () => {
client.call("reload", undefined).catch(() => {})
@@ -16,6 +16,12 @@ describe("tui thread", () => {
expect(source).not.toContain('import("./app")')
})
test("forwards the CLI environment to the TUI worker", async () => {
const source = await Bun.file(new URL("../../../src/cli/cmd/tui.ts", import.meta.url)).text()
expect(source).toMatch(/new Worker\(file, \{\s*env: Object\.fromEntries\(\s*Object\.entries\(process\.env\)/)
})
async function check(project?: string) {
await using tmp = await tmpdir({ git: true })
const link = path.join(path.dirname(tmp.path), path.basename(tmp.path) + "-link")