4

I've created task (tasks.json) for setting environment variable as below

export SOME_IP_VARIABLE=1.2.3.4 

my application needs IP parameters so I added args in launch.json as below

... "configuration":[ ... "args":[ "${env:SOME_IP_VARIABLE} ] ... 

When I print argv value in the application, this prints nothing.

Did I miss something?

5
  • Maybe this can help - stackoverflow.com/questions/29971572/… Commented May 11, 2020 at 6:19
  • 1
    Environment variables defined in shell scripts only exist for the shell script and any child processes so SOME_IP_VARIABLE doesn't exist after your task finishes executing. What are you trying to achieve? Commented May 11, 2020 at 6:56
  • @AlanBirtles I thought If I export environment variables, the variables can be shared with launch.json because launch.json calls task. I'm not familiar with linux system so I thought environment variable works just like windows system variable. thanks for your help. Commented May 11, 2020 at 7:24
  • try to add env in launch.json directly Commented May 12, 2020 at 1:28
  • Take a look here stackoverflow.com/a/70748562/3223785 . 🤗 Commented Jan 18, 2022 at 0:47

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.