refactor(workdir): remove unnecessary global NoConfirm mutation in removeMake (#2906)
refactor(workdir): remove unnecessary global NoConfirm mutation in removeMake removeMake always removes packages non-interactively, so it sets settings.NoConfirm = true, calls BuildPacmanCmd, then restores the original value. This pattern is thread-unsafe and redundant because BuildPacmanCmd already accepts a noConfirm bool parameter. Pass true directly to BuildPacmanCmd, eliminating the global mutation.
This commit is contained in:
1 parent
bc68b37ede
commit
f76bbba9be
1 file changed
+3
-4
@@ -26,11 +26,10 @@ func removeMake(ctx context.Context, config *settings.Configuration,
|
||||
removeArguments.AddTarget(pkg)
|
||||
}
|
||||
|
||||
oldValue := settings.NoConfirm
|
||||
settings.NoConfirm = true
|
||||
// removeMake always runs non-interactively; pass noConfirm=true directly
|
||||
// rather than mutating the global settings.NoConfirm.
|
||||
err = cmdBuilder.Show(cmdBuilder.BuildPacmanCmd(ctx,
|
||||
removeArguments, config.Mode, settings.NoConfirm))
|
||||
settings.NoConfirm = oldValue
|
||||
removeArguments, config.Mode, true))
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user