user1032752
user1032752

Reputation: 881

How to run task using sudo

I'd like to create a task in VS Code for starting/stopping my postgres server. Is it possible to run a task using sudo?

For example, sudo service postgresql start?

I've tried the following launch config but it fails with an error that it can't load such file.

        {
            "name": "Start Postgres server",
            "type": "Ruby",
            "request": "launch",
            "program": "sudo service postgresql start"
        }

Upvotes: 3

Views: 2865

Answers (1)

Yevhen Laichenkov
Yevhen Laichenkov

Reputation: 8692

Try to change the type property from Ruby to the shell.

        {
        "name": "Start Postgres server",
        "type": "shell",
        "request": "launch",
        "program": "sudo service postgresql start"
        }

Read more about tasks here.

Upvotes: 3

Related Questions