feat(unstable/task): fail task on async command failure (#16301)

Tests and implementation are found here:
https://github.com/denoland/deno_task_shell/pull/59

This is a breaking change, but `deno task` is unstable.

> This changes async commands so that on non-zero exit code they will
fail the entire task. For example:
> 
> ```jsonc
> // task that asynchronously starts a server and starts a watcher for
the frontend
> "dev": "deno task server & deno task frontend:watch"
> ```
> 
> Previously when running `deno task dev`, if `deno task server` failed,
the entire command would not fail, which kept in line with `sh`, but
it's not very practical. This change causes `deno task dev` to fail.
> 
> To opt out, developers can add an `|| exit 0`:
> 
> ```jsonc
> "dev": "deno task server || exit 0 & deno task frontend:watch"
> ```
This commit is contained in:
David Sherret 2022-10-18 08:23:53 -04:00 committed by GitHub
parent b2d0f6e913
commit 6fbd95630a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

5
Cargo.lock generated
View file

@ -1229,9 +1229,9 @@ dependencies = [
[[package]]
name = "deno_task_shell"
version = "0.5.2"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91059ae4dccefd55b84e0582683fe41e78b4287a2fe283962ea0a1698ea43d4d"
checksum = "9e4e1c86712e2cded9046ac6748cbe5dba87042f045265a51b1ac2629a7fa6c5"
dependencies = [
"anyhow",
"futures",
@ -1239,6 +1239,7 @@ dependencies = [
"os_pipe",
"path-dedot",
"tokio",
"tokio-util",
]
[[package]]

View file

@ -57,7 +57,7 @@ deno_emit = "0.9.0"
deno_graph = "0.34.0"
deno_lint = { version = "0.33.0", features = ["docs"] }
deno_runtime = { version = "0.81.0", path = "../runtime" }
deno_task_shell = "0.5.2"
deno_task_shell = "0.6.0"
napi_sym = { path = "./napi_sym", version = "0.3.0" }
atty = "=0.2.14"