visual studio code - VSCode tasks that automatically kills all other tasks on invoke - Stack Overflow

When using vs.code, I have to use a non-standard compiler, and it's easier to just run it from Mak

When using vs.code, I have to use a non-standard compiler, and it's easier to just run it from Makefile. I have it set up as a task in tasks.json. I am trying to make my postDebugTask remain in terminal if there is an error. I am trying to do that with my postDebugTask called run_flash.

BUT, if I re-invoke the build or "run" process, I want to terminate all running tasks. I am trying to do this with my preLaunchTask kill_all_tasks.

If I launch another process, it does not kill the previous process.

Really, what I want is for any time my normal task is launched, I want to kill off the previous task. Like is there any sort of task option to say "there can only be one of these tasks"?

Here is the launch configuration from my launch.json

        {
            "name": "Compile and Flash",
            "type": "node",
            "request": "launch",
            "internalConsoleOptions": "neverOpen",
            "preLaunchTask" : "kill_all_tasks",
            "postDebugTask": "run_flash",
            "presentation": {
                "hidden": false,
                "group": "terminaloutput",
                "order": 1
            },
            "runtimeExecutable": "echo"
        }

Here are my tasks:

        {
            "type": "shell",
            "label": "run_flash",
            "command": "make clean closechlink; make flash",
            "presentation": {
                "echo": true,
                "focus": true,
                "group": "build",
                "panel": "shared",
                "close": true,
                "reveal": "always",
                "showReuseMessage": true
            },
            "isBackground": false,
            "options": {
                "cwd": "${workspaceFolder}",
            },
            "runOptions": {
                "instanceLimit": 1,
            },
            "group": "build",
            "problemMatcher": { // 
                "owner": "cpp",
                "fileLocation": [
                    "relative",
                    "${workspaceFolder}"
                ],
                "pattern": {
                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                },
            }
        },
        {
            "type": "process",
            "label" : "kill_all_tasks",
            "command":[
                "${command:workbench.action.tasks.terminate}  terminateAll",
            ]
        }

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745664624a4639048.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信