mysticatea / npm-run-all

A CLI tool to run multiple npm-scripts in parallel or sequential.
MIT License
5.73k stars 239 forks source link

Feature request: Abort all tasks in Node API #51

Open tobiastom opened 8 years ago

tobiastom commented 8 years ago

I'm trying to use the Node API to keep some tasks running in the background, while other tasks are performed. Once the other tasks are finished, I'd like to abort all promises which did not finish.

It looks like there is the abortTasks function, but it's not exposed as a public API.

It would be nice if that could be changed. :)

mysticatea commented 8 years ago

Thank you for this issue!

Sounds reasonable. I need to check the direction of standard cancelable promise proposal in order to think proper API. https://github.com/tc39/proposals#readme

tobiastom commented 8 years ago

I fear there is no standard for it…

Thanks for considering it!

mysticatea commented 7 years ago

Sadly, the standard of cancelable promises has been withdrawn :cry: . I will consider my own spec.

https://github.com/tc39/proposals/commit/37e3c5a157e7b3a8211e2e0bb85c9f612b0f04fc

JoshuaKGoldberg commented 6 years ago

I don't think we need to use Promise cancellations for this one. Seems a little extreme and not backwards-compatible.

How about keeping a list of processes that are running, and providing a way to exit/kill them all?

TehShrike commented 6 years ago

There's always https://github.com/sindresorhus/p-cancelable

mysticatea commented 6 years ago

I don't think that the promise.cancel method is the right direction.

Browsers use AbortController to abort asynchronous operations. This has been standardized already. ECMAScript is following that, cancellation API is discussing (yes, resumed it!) in https://github.com/tc39/proposal-cancellation. It will be similar to AbortController but not depend on DOM API.