Skip to content

Commit

Permalink
(GH-893) Fix: Help Warns Required Elevated Rights
Browse files Browse the repository at this point in the history
When running help menus, it should not warn about the need for elevated
rights.
  • Loading branch information
ferventcoder committed Sep 13, 2016
1 parent ff7269e commit 43d6581
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/chocolatey/infrastructure.app/runners/GenericRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ private ICommand find_command(ChocolateyConfiguration config, Container containe
}
else
{
if (command.may_require_admin_access())
if (parseArgs != null)
{
warn_when_admin_needs_elevation(config);
parseArgs.Invoke(command);
}

if (parseArgs != null)
if (command.may_require_admin_access())
{
parseArgs.Invoke(command);
warn_when_admin_needs_elevation(config);
}

set_source_type(config);
Expand Down Expand Up @@ -231,6 +231,8 @@ public int count(ChocolateyConfiguration config, Container container, bool isCon

public void warn_when_admin_needs_elevation(ChocolateyConfiguration config)
{
if (config.HelpRequested) return;

var shouldWarn = (!config.Information.IsProcessElevated && config.Information.IsUserAdministrator)
|| (!config.Information.IsUserAdministrator && ApplicationParameters.InstallLocation.is_equal_to(ApplicationParameters.CommonAppDataChocolatey));

Expand Down

0 comments on commit 43d6581

Please sign in to comment.