Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(breaking): fail task on async command failure #59

Merged
merged 2 commits into from
Oct 15, 2022

Conversation

dsherret
Copy link
Member

@dsherret dsherret commented Oct 15, 2022

This changes async commands so that on non-zero exit code they will fail the entire task. For example:

// 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:

"dev": "deno task server || exit 0 & deno task frontend:watch"

Closes #50

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Nice tests

@dsherret dsherret merged commit 32cee6f into denoland:main Oct 15, 2022
@dsherret dsherret deleted the feat_async_commands_fail_all branch October 15, 2022 20:18
bartlomieju pushed a commit to denoland/deno that referenced this pull request Oct 18, 2022
Tests and implementation are found here:
denoland/deno_task_shell#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"
> ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support wait command to wait for all async commands.
2 participants