簡體   English   中英

Visual Studio Code 任務沒有環境變量設置

[英]Visual Studio Code Tasks Don't Have Environment Variables SEt

我需要運行一個使用運行任務的用戶的 UID 的 VS Code 任務。 我創建了以下任務:

    {
        "type": "shell",
        "label": "env variable",
        "options": {
            "shell": {
              "args": ["-c", "-p","-l"]
            }
        },
        "command":["echo"],
        "args": [
            "shell ",
            "${env:SHELL}",
            " username ",
            "${env:USER}",
            " homedir",
            "${env:HOME}",
            " uid: ",
            "${env:UID}",
            " gid: ",
            "${env:GID}"
        ]
    }

運行這個任務我得到:

> Executing task: echo 'shell ' /usr/bin/bash ' username ' gperez ' homedir' /home/gperez ' uid: '  ' gid: '  <

shell  /usr/bin/bash  username  gperez  homedir /home/gperez  uid:   gid:

出於某種原因,我的 env 變量的一個子集可以像 USER 和 HOME 一樣,但是 UID 和 GID 莫名其妙地沒有設置!

有人知道怎么修這個東西嗎?

順便說一句,從 VS Code 提供的終端運行 echo $UID 設置了 UID 和 GID 沒問題!

嘗試...

  1. 沒有環境:在這兩個
  2. 添加可選的“problemMatcher”:[],

喜歡

enter code here
        "type": "shell",
        "problemMatcher": [],
        "label": "env variable",
        "options": {
            "shell": {
              "args": ["-c", "-p","-l"]
            }
        },
        "command":["echo"],
        "args": [
            "shell ",
            "${env:SHELL}",
            " username ",
            "${env:USER}",
            " homedir",
            "${env:HOME}",
            " uid: ",
            "${UID}",
            " gid: ",
            "${GID}"
        ]            

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM