Skip to content

Commit

Permalink
.NET Tools that can only be installed globally should be installed gl…
Browse files Browse the repository at this point in the history
…obally - this issue was spotted thanks to telemetry :)
  • Loading branch information
marticliment committed Feb 8, 2025
1 parent aa6b40b commit 1d9e025
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ protected override IEnumerable<string> _getOperationParameters(
if (options.CustomInstallLocation != "")
parameters.AddRange(["--tool-path", "\"" + options.CustomInstallLocation + "\""]);

if (package.OverridenOptions.Scope == PackageScope.Global ||
(package.OverridenOptions.Scope is null && options.InstallationScope == PackageScope.Global))
if (package.OverridenOptions.Scope is PackageScope.Global ||
(package.OverridenOptions.Scope is null && options.InstallationScope is PackageScope.Global))
parameters.Add("--global");

if (operation is OperationType.Install or OperationType.Update)
Expand Down Expand Up @@ -66,6 +66,12 @@ protected override OperationVeredict _getOperationResult(
IEnumerable<string> processOutput,
int returnCode)
{
return returnCode == 0 ? OperationVeredict.Success : OperationVeredict.Failure;
if (returnCode is not 0 && package.OverridenOptions.Scope is not PackageScope.Global)
{
package.OverridenOptions.Scope = PackageScope.Global;
return OperationVeredict.AutoRetry;
}

return returnCode is 0 ? OperationVeredict.Success : OperationVeredict.Failure;
}
}
3 changes: 2 additions & 1 deletion src/UniGetUI.PackageEngine.Operations/AbstractOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,11 @@ public async Task MainThread()
OperationVeredict result;
Line(CoreTools.Translate("Starting operation..."), LineType.ProgressIndicator);
if (Status is OperationStatus.InQueue) Status = OperationStatus.Running;
OperationStarting?.Invoke(this, EventArgs.Empty);

do
{
OperationStarting?.Invoke(this, EventArgs.Empty);

try
{
// Check if the operation was canceled
Expand Down

0 comments on commit 1d9e025

Please sign in to comment.