gruntjs / gruntjs/grunt

Execute another task within my task (without queueing the other one)

Open
#1,366 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.2k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Is there an API for executing another task from within my task?

I'd like to execute another task from within my own, then perform some cleanup tasks afterwards _even if the other task failed._

Tasks like [grunt-newer](https://github.com/tschaub/grunt-newer) currently have to resort to tricks where they queue the other task to run immediately after themselves. There are workarounds to ensure that, even if the other, queued task fails, post-task cleanup actions will still occur. This could be avoided with a simple API to execute another task.

Possible API:

`grunt.task.runTaskNow(taskName, arguments, /*optional*/ config);`

Contributor guide

Open the contributing guide

Research direction

Begin with Grunt's existing task execution and queueing behavior, using the proposed grunt.task.runTaskNow(taskName, arguments, config) signature as the starting point. Examine how nested task failure should interact with cleanup, then establish the API's semantics and implementation scope; done requires a settled approach that avoids queueing the nested task.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.