task icon indicating copy to clipboard operation
task copied to clipboard

Elevated Privileges / Sudo mode per command

Open boukeversteegh opened this issue 2 years ago • 1 comments

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.

boukeversteegh avatar Jul 24 '23 19:07 boukeversteegh

ping, maybe this could be achived by #448

ccxuy avatar Aug 20 '24 11:08 ccxuy