Visual Studio Code and sudo

rkayakr 1 Reputation point
2022-09-23T23:04:12.617+00:00

I'm developing C code on a Raspberry Pi that uses the pigio library to access GPIO pins and I2C and SPI busses. The source and executable are in my user space but program execution requires sudo to get the necessary privileges to execute. I would like to use the debugging facilities in VS Code, haven't found a way to get it to launch with privileges.

I tried from the source directory

sudo code "your-directory" --user-data-dir='.' --no-sandbox

but it didn't allow me to launch

I saw this note in an online post:

sudo code myfile stopped working sometime in July/August 2021

How can I debug or even execute code that requires root privileges within VS Code?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,646 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JosePichardo22-9478 1 Reputation point
    2022-09-23T23:04:43.707+00:00