task
task copied to clipboard
Elevated Privileges / Sudo mode per command
I would like a command to run in sudo mode (unix) or as Administrator (windows).
Use case: Defining the install commands for a flutter project.
On windows, it requires installing fvm. The recommended method is to use choco install fvm, which must be run as a Administrator on windows.
The current work-around would be to open a terminal as adminstrator, and run everything as admin (not so safe, and may have side-effects). The better solution would be to automatically 'elevate' for the commands that need it.
tasks:
install:fvm:
cmds:
- cmd: choco install fvm -y
platforms: [windows]
sudo: true # <-- opens a UAC dialog to elevate privileges, then runs the command
- cmd: brew tap leoafarias/fvm
platforms: [darwin]
- cmd: brew install fvm
platforms: [darwin]
If the maintainers think this is a useful feature, I'm interested in implementing it.
ping, maybe this could be achived by #448