Skip to content

Commit 0b61046

Browse files
fix(plugins): handle reinstall cleanly in installPlugin handler
Previously, reinstalling an already-installed plugin would start a second process without stopping the first one (duplicate processes sharing the same UUID key in pluginProcesses Map, old process leaked). Now the handler stops and removes the existing plugin entry before copying the new files, so reinstalling cleanly replaces the running process. Also adds force:true to cp so files are always overwritten.
1 parent 4a60915 commit 0b61046

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

electron/main.cjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,12 @@ function registerIpcHandlers() {
544544
return { ok: false, error: 'Invalid manifest: missing UUID or Actions array' }
545545
}
546546
const destDir = path.join(getPluginsDir(), `${manifest.UUID}.sdPlugin`)
547+
// Stop and remove any existing installation with the same UUID (handles reinstall)
548+
stopPlugin(manifest.UUID)
549+
pluginManifests = pluginManifests.filter(p => p.manifest.UUID !== manifest.UUID)
547550
try {
548551
await fs.promises.mkdir(getPluginsDir(), { recursive: true })
549-
await fs.promises.cp(resolved, destDir, { recursive: true })
552+
await fs.promises.cp(resolved, destDir, { recursive: true, force: true })
550553
} catch (err) {
551554
return { ok: false, error: err.message }
552555
}

0 commit comments

Comments
 (0)