fix: stop git service when switching install roots

This commit is contained in:
Shakker
2026-06-10 20:40:31 +01:00
committed by Shakker
parent e44835ae29
commit 124625ec4d
2 changed files with 52 additions and 3 deletions
+7 -3
View File
@@ -3469,14 +3469,16 @@ async function updateCommandInternal(opts: UpdateCommandOptions): Promise<void>
const preUpdatePluginInstallRecords = await loadInstalledPluginIndexInstallRecords();
let preManagedServiceStop: PreManagedServiceStop | undefined;
const stopManagedServiceBeforeMutableUpdate = async () => {
const gitMutationRoot =
updateInstallKind === "git" ? (switchToGit ? resolveGitInstallDir() : root) : null;
const stopManagedServiceBeforeMutableUpdate = async (mutationRoot: string = root) => {
if (updateInstallKind !== "package" && updateInstallKind !== "git") {
return;
}
try {
preManagedServiceStop = await maybeStopManagedServiceBeforeMutableUpdate({
updateInstallKind,
root,
root: mutationRoot,
shouldRestart,
jsonMode: Boolean(opts.json),
});
@@ -3552,7 +3554,9 @@ async function updateCommandInternal(opts: UpdateCommandOptions): Promise<void>
stop,
devTargetRef,
beforeGitMutation:
updateInstallKind === "git" ? stopManagedServiceBeforeMutableUpdate : undefined,
updateInstallKind === "git"
? () => stopManagedServiceBeforeMutableUpdate(gitMutationRoot ?? root)
: undefined,
});
} catch (err) {
stop();