Open e-t-l opened 9 months ago
Okay so jotting down some notes:
commandline
that requires elevation to work right. elevate: true
on the profile with that commandlineI suppose the question I have is: why not just set elevate:true
on the profile, if you've already got a command that you know requires admin permissions?
Okay so jotting down some notes
...Did you, though? Because the 2nd and 3rd paragraphs of my post described multiple examples and use cases outside of the one specific scenario that your comment is about.
If I was unclear or if you'd like to discuss similar use cases in more detail, I'm more than happy to contribute to that discussion.
if you've already got a command that you know requires admin permissions?
To answer the question I'll assume you're asking in good faith: just like in the scenarios I described in my first post, this would be most useful for the typical user who runs a CLI app, batch file, or Win+R
command without realizing it required elevation. The scenario you described, where a user deliberately launches Terminal.exe in a specific profile configuration, is not the focus of this issue.
Description of the new feature/enhancement
When
closeOnExit: "never"
, exiting a Terminal process outputs the message, "You can now close this terminal with Ctrl+D, or press Enter to restart." This enhancement is to suggest expanding this functionality with the self-explanatory, "or press Ctrl+Shift+Enter to restart as Administrator."One example where this would be very helpful is when a user runs unelevated a CLI program, batch file, etc. that requires elevation to perform properly. This currently returns "Access is denied." and the user has to go relaunch the program with deliberate elevation (for example, by right-clicking the program shortcut and clicking "Run as administrator"). Instead, I propose that the user could simply press Ctrl+Shift+Enter to re-run the same command/program with elevation.
For a long time in Windows, users have been able to Ctrl+Shift+click on a batch file or shortcut to launch it elevated, or press Ctrl+Shift+Enter to run a command with elevation from the Win+R Run dialog. It would be consistent and intuitive UX to provide users a similar keyboard combination to elevate the command from within Terminal itself.
Proposed technical implementation details (optional)
I imagine this would involve something along the lines of replacing the current Terminal process/tab with one that is elevated to Administrator privileges but otherwise identical, and re-running the initial command that called it (if any).
Ideally it would also pass along any variables and such from the exited process. In this way, it would function similar to gsudo. (This bit, while more complex to implement, could partially address #146 as well.)