我正在Windows 10 Home上使用VSCode
版1.31.0
。我已启用WSL,并安装了nvm,pyenv等工具,这需要在.bashrc
和.bash_profile
上运行的其他脚本
例如在.bashrc
中:
export PATH="/custom/path:$PATH"
运行集成外壳程序(CTRL + `
)时,一切正常,因为我看到$PATH
包含/custom/path
但是当我尝试运行任务脚本(https://code.visualstudio.com/docs/editor/tasks#vscode)
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "eslint",
"problemMatcher": [
"$eslint-stylish"
]
},
{
"label": "Run tests",
"type": "shell",
"command": "./scripts/test.sh",
"presentation": {
"reveal": "always",
"panel": "new"
}
}
]
}
test.sh中的内容
echo $PATH
当我尝试运行任务“运行测试”时,它没有显示/custom/path
,或者实际上,~/.bashrc
和~/.bash_profile
中的任何内容都不包括在内。
我什至在test.sh中尝试过类似的方法,但仍然无法加载我的.bashrc
source /home/user/.bashrc
echo $PATH
下面是我的VSCode用户设置:
{
"terminal.external.windowsExec": "C:\\windows\\Sysnative\\bash.exe",
"terminal.integrated.shell.windows": "C:\\windows\\Sysnative\\bash.exe",
"terminal.integrated.shellArgs.windows": ["--login"],
"eslint.provideLintTask": true
}
问题是:
如何设置VSCode或Windows使用我的.bashrc
或.bash_profile
运行任务?
答案 0 :(得分:0)
这是因为我的*ngIf="user"
.bashrc
因此,在更新了我的VSCode设置后,如下所示:
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac#
我的{
"terminal.external.windowsExec": "C:\\windows\\Sysnative\\bash.exe",
"terminal.integrated.shell.windows": "C:\\windows\\Sysnative\\bash.exe",
"terminal.integrated.shellArgs.windows": ["-i"],
"eslint.provideLintTask": true
}
中的其余命令将被执行