Run debug session as sudo
See original GitHub issueEnvironment data
dotnet --info
output:
.NET Command Line Tools (2.0.0)
Product Information: Version: 2.0.0 Commit SHA-1 hash: cdcd1928c9
Runtime Environment: OS Name: ubuntu OS Version: 16.04 OS Platform: Linux RID: ubuntu.16.04-x64 Base Path: /usr/share/dotnet/sdk/2.0.0/
Microsoft .NET Core Shared Framework Host
Version : 2.0.0 Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
VS Code version: 1.17.2 b813d12980308015bcd2b3a2f6efa5c810c33ba5
C# Extension version: 1.12.1
Steps to reproduce
- Create a console project.
- Execute bash command in code that requires sudo permission
Expected behavior
command to be executed with root privilege.
Actual behavior
permission denied error
I have looked in launch settings documentation and also intellisense but I cannot see anywhere to set my debug launch options to use sudo. The work around is to launch VS Code as root but I have seen other languages vs code debuggers like python have ability to set it as a launch parameter for debugging session.
Is there any way to do this?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top GitHub Comments
FYI, it worked for me by throwing
sudo
in front of thedebuggerPath
, not ideal, bujt allowed me to debug.E.g.
@GuerrillaCoder from what I can tell,
gksudo
will not redirect stdin/out across, so it might be possible for the extension to use it internally to add this feature, but it wouldn’t work as apipeTransport
. Thinking more,sudo
wouldn’t work as there would be no way to pass in the password. I think the only thing that could work today would be to SSH into your own computer as root.I will leave this open as a feature request. I think we could do this without too much effort by running sudo in the VS Code terminal.