-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alow standalone bun executable to use local bun instance in Bun.$
#16829
base: main
Are you sure you want to change the base?
Conversation
…i (ie bun install)
Seems nice Needs a test though |
Done, i added tests! Also should The issue that this is closing wants it for |
My two cents, |
Makes sense, to simplify I'll just make it always try to use the same executable (otherwise it would just be weird code to check if standalone and do one bit earlier) and it kinda made sense the way it was written in docs to use same bun |
Node has a child_process.fork() function to call the node executable and pass it args, it would make sense for it to work in standalone executables import { fork } from "child_process";
fork("-p", ["1 + 1"]); In node/bun, that prints |
Oh nice, I didn't know about it. Might see if it's simple to add env var there too |
for minifying, there should be a build config for what parts to be included into executable |
Added support! I'm surprised this child_processes stuff is all in JS 😅 |
Yeah, I don't know the plan for that, but its way out of scope for this pr. I'd think at least initially your suggestion of flag makes most sense (but there has to be some way of bun knowing which parts of bundle to delete - which gets harder with more interconnected stuff). |
i just realized about |
What does this PR do?
Ensures you can always do this, even when in standalone and no bun in path:
currently it will use same executable if no bun in path, however standalone it just infinite loops because its running itselfNow it will always try to use the same bun that started it (including standalone). fixes #16262, fixes #14459, fixes #5414uses @pfgithub's solution and extends it to be able to use in safer Bun shell
concerns: implies the whole binary will be available forever, so could be harder to minify and remove unneeded parts
How did you verify your code works?
will need to test with the the CI's release build