how to run a sequence of tasks in VSC that does not stop when one "fails"?

Viewed 48

I'm trying to implement "clean" and "clean all" in VSC through tasks.json, using the PowerShell Remove-Item command.

The command that is run, for each app in the project, looks like this:

Remove-Item -Recurse -Force -ErrorAction Ignore build

and basically I have chained these together to define "clean all", like this:

"label": "clean all",
  "dependsOrder": "sequence",
  "dependsOn": [
    "clean app1",
    "clean app2",
    "clean app3
  ],
  "problemMatcher": [],
  "group": "build",
},

This works fine, unless the build dir doesn't exist for one of the apps, in which case the execution will halt. This seems to happen because the Remove-Item command (despite being passed the -ErrorAction Ignore flag) returns False if the target does not exist.

An easy workaround is to run the tasks in parallel, of course, but while functiona, that doesn't quite appeal. Does anyone know a way to get VSC to perform all tasks in the sequwnce, even if one of them "fails" (not fails)?

0 Answers
Related