【问题标题】:Ignore error from the preivous build task in tasks.json忽略tasks.json中上一个构建任务的错误
【发布时间】:2021-06-09 14:22:12
【问题描述】:

我配置了tasks.json 来构建和运行应用程序。

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "make"
        },
        {
            "label": "close the file",
            "type": "shell",
            "command": "somecommand"
        },
        {
            "label": "Run build",
            "dependsOn": [
                "build",
                "close the file"
            ],
            "dependsOrder": "sequence",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

流程首先执行make 命令,然后执行somecommand。问题是有时make 命令返回的退出代码不是零,因为somecommand 没有执行。有什么办法可以忽略之前的构建状态,一直执行somecommand

【问题讨论】:

  • 编写一个 shell 脚本并用一个任务运行它
  • @rioV8,是的,我现在正在这样做。但是还有其他方法可以解决这个问题吗?

标签: visual-studio-code vscode-settings vscode-tasks


【解决方案1】:

在我的例子中是一个简单的 Power Shell:

-ErrorAction Ignore 

做这项工作,但这取决于你在做什么。 Here's the reference for the shell.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-23
    • 2019-02-22
    • 2022-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-11
    相关资源
    最近更新 更多