microsoft / microsoft/vscode-java-debug

Add "run as sudo" to launch.json for VSC Java project

オープン
#953 コメント 2 件 リアクション 1 件 担当者 1 名 GitHub で見る

@testforstephen がすでに取り組んでいます。

2021年4月28日 から。

ai-triaged enhancement feature request launch
主要言語
TypeScript
スター
591
フォーク
429
平均マージ
1日 9時間
マージ済み PR(30日)
19

説明

I'm working on the Pi4J project (https://v2.pi4j.com/) to control GPIOs with a Java application. Pi4J uses a native library to communicate with the GPIOs. For some protocols (like I2C) the library needs to be called with "sudo". I know this is a bad idea and should be avoided, and we are looking for an alternative solution, but in the mean-time I found out you can't run or debug a Java application in VSC as sudo.

You could launch VSC itself as sudo, but this gives the following warning, so that's probably even a worse idea ;-)

$ sudo code
You are trying to start Visual Studio Code as a super user which isn't recommended. If this was intended, please specify an alternate user data directory using the `--user-data-dir` argument.
Environment
  • Operating System: Raspberry Pi OS (Linux, Debian)
  • JDK version: OpenJDK 11.0.9.1
  • Visual Studio Code version: 1.53.2
  • Java extension version: Java Extension Pack 0.12.1
  • Java Debugger extension version: 0.31.0
Steps To Reproduce
  1. Create a launch.json file, e.g.
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Launch CrowPiApp",
            "request": "launch",
            "mainClass": "com.pi4j.example/com.pi4j.example.CrowPiApp",
            "projectName": "pi4j-example-crowpi",
            "args": "-a -p"
        }
    ]
}
  1. It should be possible to add extra setting
    "sudo": true
Current Result

sudo setting not available

Expected Result

sudo true/false can be defined

Additional Informations

The example project is https://github.com/Pi4J/pi4j-example-crowpi

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。