-
Notifications
You must be signed in to change notification settings - Fork 36
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
Passing on C argv to the script environment #16
Comments
You're welcome to submit a pull request. I've been super busy with other projects at the moment. |
Ok, I'll do that. The only non-trivial thing is to figure out where that array should go :) |
It seems |
Initially I don't think uv is the right place, but then again it needs access to it anyway for proper setup so maybe it's not crazy after all. |
To mimic Node.js it could be Placing it in |
The way I do this in luvit is to pass the arg list to the script as part of the main bootstrap. |
I thought of |
Right, that would work. It would be nice if libuv accepted this as an official API. I wonder what they think of adding it. |
Yeah, one simple approach would be to construct the argv array in |
Looking through libuv, I don't think they store the full argv, but we could store a copy in our bindings to uv_setup_args somewhere. |
I like the global stash idea. Do whatever you think is best. My only preference is to diverge from libuv as little as possible. |
It'd be nice to read it back from libuv but that doesn't seem possible. I'll open a pull with a proposal, thanks! |
Are there plans to pass on the C
argv
into the script environment to allow scripts to do command line parsing? This would be quite useful for e.g. Duktape's DukLuv based JSON proxy.I tried to figure out if there's any binding currently and it seems
src/main.c
gives argc/argv touv_setup_args()
but I guess it's not passed on otherwise?I'll be happy to contribute a pull if necessary.
The text was updated successfully, but these errors were encountered: