mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-11 12:12:55 +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) => {
|
||||
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