I have the latest VS Code installed on my Windows 10 machine. I currently have a task.json file setup like so:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"windows": {
"command": "${workspaceRoot}\\build.bat"
},
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "dedicated"
}
}
]
}
I'm using this task to run my build.bat file which contains the following line:
if not defined DevEnvDir ( call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" )
Which should only be calling "vcvars64.bat" upon the first execution of the terminal.
The problem is the "panel" : "dedicated" option, according to the docs, should be reusing the same terminal instance with each build, thus only calling vcvars64.bat once. But each time I build, vcvars64.bat is called every time. When I just build from a regular, external cmd terminal, or when I build from VS Code's internal terminal (using cmd) everything works as expected when building subsequent times. It's only when trying to run the task does this problem occur. Anyone know what the issue is?
I think it is a ambiguity in the documentation. If you see the intellisense, it clearly states that the Panel is dedicated to the build task and not the Terminal that is runs inside that panel as such
I have verified that using a simple command: "(env | grep -i NAME) && export NAME=TARUN"
If it was a linux/mac environment you could have tried with 2 build task, keeping one alive to receive instruction and the build task to send instructions to the same using a named pipe. As explained in below link
https://www.linuxquestions.org/questions/linux-newbie-8/%5Bbash%5D-send-command-to-another-terminal-831313/
The bash script they used is
#!/bin/bash
PIPE=/tmp/catpipe
trap "rm -f $PIPE" exit 1
[[ ! -p $PIPE ]] && mkfifo $PIPE
while true; do
while read line; do
case "$line" in
@exit) rm -f $PIPE && exit 0;;
@*) eval "${line#@}" ;;
* ) echo "$line" ;;
esac
done <$PIPE
done
exit 2
And then the other bash could just send the commands to that pipe. But unfortunately, I can't see pipe in Windows CMD.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With