Implement queue work and listen commands
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-01-27 10:34:01 -06:00
parent e098a5edb7
commit 16e5fa00aa
19 changed files with 271 additions and 17 deletions

View File

@@ -468,4 +468,22 @@ export abstract class Directive extends AppClass {
protected nativeOutput(...outputs: any[]): void {
console.log(...outputs) // eslint-disable-line no-console
}
/**
* Get a promise that resolves after SIGINT is received, executing a
* callback beforehand.
* @param callback
* @protected
*/
protected async untilInterrupt(callback?: () => unknown): Promise<void> {
return new Promise<void>(res => {
process.on('SIGINT', async () => {
if ( callback ) {
await callback()
}
res()
})
})
}
}