在尝试在vscode中启动Debug会话时,它会抛出一个关于未找到指定任务的错误。我已经尝试了其他SO问题的解决方案,比如这个,但是没有成功。
launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
...
},
{
"name": "MSEventHubs_Audit",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/audit-events.py",
"console": "integratedTerminal",
"args": [
"config/config.ini",
],
"envFile": "${workspaceFolder}/.env",
"env": {"PYTHONPATH": "${workspaceRoot}"},
"justMyCode": false,
"preLaunchTask": {
"task": "audit_tunnel"
}
},
{
...
},
]
}
tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"command": "",
"args": [],
"tasks": [
{
"label": "activate_key",
"type": "shell",
"command": "smartOS_card_pin.sh",
"args": [
"${inputs:cardos_pass}"
],
"group": "build",
},
{
"label": "audit_tunnel",
"type": "shell",
"group": "build",
"command": "ssh",
"args": [
"-NL",
"port1:127.0.0.1:port2",
"my_host"
],
"dependsOn": "activate_key"
},
{
...
}
],
"inputs": [
{
"id": "cardos_pass",
"type": "promptString",
"password": true
}
]
}
我一直在看,但是无法弄清楚自己做错了什么。证明我的任务被VSCode识别的方式是当弹出消息出现时。
我点击“配置任务”,“audit_tunnel”出现作为编辑选项。
我错过了什么吗?
"command": "", "args": [],
,因为这看起来是之前的语法。请参考https://code.visualstudio.com/Docs/editor/tasks#_migrating-to-tasks-200。另外,如果你只运行`audit_tunnel`,它能被找到吗?你可以在里面加一个echo以便于测试。 - Mark