Closed SaadAhmedGit closed 3 months ago
CC @hyangah
Thank you for the issue. Given that this is a rare need, there's an existing workaround (run from the command line), and it would require a new UI and has perhaps complicated security implications, I would not be surprised if this does not get prioritized soon.
https://github.com/golang/vscode-go/wiki/debugging#launchjson-attributes
See asRoot
. You will need to configure launch.json
configuration.
@hyangah I saw that (or rather, the related issue), but thought it applied only to debug. Does it apply to run as well?
@hyangah I saw that (or rather, the related issue), but thought it applied only to debug. Does it apply to run as well?
You're right. It only applies to debugging and is not available in tasks.json
You can define your own tasks.json
that invokes sudo and necessary arguments. Or, you can use launch.json but use ^+F5 (ironic "Debug: Start Without Debugging").
However, as @findleyr said, allowing to easily run tests as a root has security implication, and may result in undesirable side effects. Given this is not frequently needed nor desirable, I agree we won't prioritize this.
For security reasons this doesn't seem like a problem we should attempt to solve in VS Code. Closing as infeasible.
Is your feature request related to a problem? Please describe. My program has to interact with wireguard thus it needs to have root privileges.
Describe the solution you'd like Some way to configure privileges when running tests. It can ask for sudo password and then run the tests as root.
Describe alternatives you've considered Running the tests from command line with
sudo
.