mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 01:22:54 +00:00
feat: unregister plugin on exit
This commit is contained in:
12
src/cli.ts
12
src/cli.ts
@@ -68,3 +68,15 @@ pluginClient.registerPlugin(plugin)
|
|||||||
.catch((err: Error) => {
|
.catch((err: Error) => {
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[`exit`, `SIGINT`, `SIGUSR1`, `SIGUSR2`, `SIGTERM`].forEach((signal) => {
|
||||||
|
process.once(signal as NodeJS.Signals, () => {
|
||||||
|
pluginClient.unregisterPlugin(plugin)
|
||||||
|
.then(() => {
|
||||||
|
Logger.ok(`Successfully unregistered plugin '${options.pluginName}' from /${options.routeName} .`);
|
||||||
|
})
|
||||||
|
.catch((err: Error) => {
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
}) ;
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user