vilicvane / clime

⌨ The command-line interface framework for TypeScript.
252 stars 10 forks source link

[Question] How implement shutdown #54

Closed galkin closed 1 year ago

galkin commented 5 years ago

Thank you for awesome package. Some of my command can take more than 3 minutes. Do we have best practice for shutdown the command execution?

vilicvane commented 5 years ago

Hi, are those commands synchronous or asynchronous? And who will perform the "shutdown" operation? Ctrl+C or the command itself?

galkin commented 5 years ago

Hi, are those commands synchronous or asynchronous?

asynchronous with async/await

And who will perform the "shutdown" operation?

User press Ctrl+C, command should graceful shutdown. For example, disconnect from DB, close file, etc.

vilicvane commented 5 years ago

I see, currently I don't think there are direct related features implemented by clime. To be honest, I don't think the Promise idea behind clime is suitable for describing this. RxJS might serve this purpose better though.

I think I could add a built-in shim with RxJS support in future versions, the core might need a little bit modification for types.

galkin commented 1 year ago

closed as clime didn't receive updates for long time