Skip to content
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

question about usage WingetPathUpdater usage with gsudo #4

Closed
soredake opened this issue Jan 2, 2024 · 3 comments
Closed

question about usage WingetPathUpdater usage with gsudo #4

soredake opened this issue Jan 2, 2024 · 3 comments

Comments

@soredake
Copy link

soredake commented Jan 2, 2024

For example, i will do sudo { winget install Python.Python.3 } with https://github.com/gerardog/gsudo to avoid uac (I have cache enabled), python will be installed, but the problem is, path will be reloaded in sudo { } scope, so I will still need to restart terminal in order to use python, is it possible to update env outside of sudo scope?

@jazzdelightsme
Copy link
Owner

That's a good question.

The same principles described in the main ReadMe would apply here:

  • Somehow, there will have to be code that runs in your shell.
  • There will need to be a "diff" (capture environment variables before, capture environment variables after, then compare).

You could do it manually, using the code in WingetHelper.ps1. Take a look at the code in Winget.ps1 for how it is used.

If you wanted to make sudo magically do it for you, you would have to play the same trick on sudo that I played on winget: replace it with a shell script--so if you use PowerShell as your shell, you would have sudo.ps1, which would behave similarly to Winget.ps1: capture current vars, "do the thing" (forward to the real sudo), capture vars again, compute and apply diff.

Out of curiosity, where do you get sudo from? I am familiar with the concept of "sudo", but I don't think I have ever used it on Windows.

@soredake
Copy link
Author

soredake commented Jan 5, 2024

Out of curiosity, where do you get sudo from?

https://github.com/gerardog/gsudo, very convenient software.

@jazzdelightsme
Copy link
Owner

I see that gsudo already has a PowerShell module... it should be trivial for someone to port the functionality of this project to that one. (Wouldn't help if you use gsudo from one of the other shells it supports, but it probably wouldn't be too bad to handle those, too, the same way that Winget.cmd does it.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants