npm-run-all icon indicating copy to clipboard operation
npm-run-all copied to clipboard

Feature request: Abort all tasks in Node API

Open tobiastom opened this issue 8 years ago • 6 comments

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. :)

tobiastom avatar Jun 23 '16 11:06 tobiastom

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

mysticatea avatar Jun 24 '16 02:06 mysticatea

I fear there is no standard for it…

Thanks for considering it!

tobiastom avatar Jun 29 '16 21:06 tobiastom

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

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

mysticatea avatar Dec 16 '16 01:12 mysticatea

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?

JoshuaKGoldberg avatar Oct 30 '18 19:10 JoshuaKGoldberg

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

TehShrike avatar Oct 30 '18 19:10 TehShrike

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.

mysticatea avatar Oct 31 '18 02:10 mysticatea