tristanisham / zvm

zvm (Zig Version Manager) lets you easily install/upgrade between different versions of Zig.
https://www.zvm.app
MIT License
487 stars 32 forks source link

Limiting Elevated Scripts on Windows #62

Closed tristanisham closed 7 months ago

tristanisham commented 8 months ago

59 Is there any way to limit the powers of this file to only elevate a limited set of commands? Leaving a generic elevate.cmd file siting on a user's system leaves a bad taste in my mouth, @nithinkjoy-tech.

tristanisham commented 8 months ago

@nithinkjoy-tech, could you look into how to replace your CMD and VBS scripts with Go code. I'd like for us to have a way to tell if we're running as administrator, and to rerun ourselves as administrators with the user's commands.

nithinkjoy-tech commented 8 months ago

@tristanisham I was busy in other works. Sure will check its possibility.

nithinkjoy-tech commented 8 months ago

@tristanisham Wow, I saw better solution Implemented by you. It looks cool and awesome. 🤩

tristanisham commented 8 months ago

Thanks @nithinkjoy-tech, but I was just building off your excellent pull request. I'd have no idea this was an issue still if not for you. Thanks.

I was wondering if you'd look over my alternative implementation. It seems more powerful but I don't know enough about Windows to be sure it's right.

nithinkjoy-tech commented 8 months ago

@tristanisham image I am getting this error when I run in non-administrative terminal.

tristanisham commented 8 months ago

@nithinkjoy-tech Is that on the branch or currently on Master?

nithinkjoy-tech commented 8 months ago

@tristanisham Its happening in master aswell as after installing using powershell script.

tristanisham commented 8 months ago

@nithinkjoy-tech Can you run it again with ZVM_DEBUG=1? That should print a bunch of extra information that'll let us debug where and what's breaking.

tristanisham commented 8 months ago

Might be tied to #63

nithinkjoy-tech commented 7 months ago

image Have Set ZVM_DEBUG=1 as env variables.

Are we trying to remove the already removed bin directory?

tristanisham commented 7 months ago

Try using the latest release v0.6.5/4 I can't remember, I put so many releases out yesterday. 😂

nithinkjoy-tech commented 7 months ago

Try using the latest release v0.6.5/4 I can't remember, I put so many releases out yesterday. 😂

😂 Will check.

nithinkjoy-tech commented 7 months ago

@tristanisham Yeah, v0.6.7 works 🔥

nithinkjoy-tech commented 7 months ago

@tristanisham But when installing new version it installs twice, one in normal shell and again in eleveted shell. image