microsoft/sudo

Elevate Current Shell

Jack-Chronicle opened this issue · 2 comments

Description of the new feature / enhancement

using the sudo command with no options elevates the current shell, without opening a new window if set to work inline
or add an option tag to do so, Linux/Unix systems use sudo su to do so

Scenario when this would be used?

When opening a non elevated command prompt, but later needing elevated permissions for multiple commands
Could also be used in individual tabs to allow you to go back from a non elevated tab when not needing elevated permissions and not cluttering the screen with multiple windows

Supporting information

No response

Why does sudo -E cmd (or sudo -E pwsh or whatever your shell is) not work for you/? It's a couple extra characters, but it does what you want while being more precise - copy the current environment into an elevated instance of the shell you want, in the current console.

(assuming of course you've set the sudo config to inline mode of course)

That seems to work well, I think it wasn't working for me when I made this issue or I was being picky.
It may have also been recently added during an update, I'm not sure.

Either way, seems to be okay now