Fix: Plugins without start/stop function failing to stop/start (#2463)
This commit is contained in:
parent
54f58cd7c9
commit
0460374af0
1 changed files with 5 additions and 2 deletions
|
@ -170,13 +170,14 @@ export const startPlugin = traceFunction("startPlugin", function startPlugin(p:
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
p.start();
|
p.start();
|
||||||
p.started = true;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(`Failed to start ${name}\n`, e);
|
logger.error(`Failed to start ${name}\n`, e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.started = true;
|
||||||
|
|
||||||
if (commands?.length) {
|
if (commands?.length) {
|
||||||
logger.debug("Registering commands of plugin", name);
|
logger.debug("Registering commands of plugin", name);
|
||||||
for (const cmd of commands) {
|
for (const cmd of commands) {
|
||||||
|
@ -206,6 +207,7 @@ export const startPlugin = traceFunction("startPlugin", function startPlugin(p:
|
||||||
|
|
||||||
export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plugin) {
|
export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plugin) {
|
||||||
const { name, commands, flux, contextMenus } = p;
|
const { name, commands, flux, contextMenus } = p;
|
||||||
|
|
||||||
if (p.stop) {
|
if (p.stop) {
|
||||||
logger.info("Stopping plugin", name);
|
logger.info("Stopping plugin", name);
|
||||||
if (!p.started) {
|
if (!p.started) {
|
||||||
|
@ -214,13 +216,14 @@ export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plu
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
p.stop();
|
p.stop();
|
||||||
p.started = false;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(`Failed to stop ${name}\n`, e);
|
logger.error(`Failed to stop ${name}\n`, e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.started = false;
|
||||||
|
|
||||||
if (commands?.length) {
|
if (commands?.length) {
|
||||||
logger.debug("Unregistering commands of plugin", name);
|
logger.debug("Unregistering commands of plugin", name);
|
||||||
for (const cmd of commands) {
|
for (const cmd of commands) {
|
||||||
|
|
Loading…
Reference in a new issue