#How to disable bun preload?

1 messages · Page 1 of 1 (latest)

compact lynx
#

I have a preload script that spawns a bun child process. But when that child process is spawned, it loads same preload recursively spawns another bun and so on and results in infinity loop completely filling up memory. Any ideas how to make bun not load the preload script when spawning?

oblique crown
#

i don't think there is a built in flag but to make this only load once try passing an environment variable like HAS_LOADED_THING=1

compact lynx
#

and bun is there in path

#

@oblique crown new bug found

#

🙂

#

preload.ts

console.log(Bun.argv[2], Object.keys(process.env).length);
Bun.spawnSync(["bun", ".", "--second"], { stdout: "inherit", env: {} });
#

apparently env wipes out whole env when spawn

#

is it intended?

oblique crown
#

i meant passing an extra env var to signify it was already loaded