Skip to content

Commit

Permalink
[ARM][Settings][CmdNotFound]Fix CmdNotFound page init (#32892)
Browse files Browse the repository at this point in the history
On ARM, process does not inherit environment, so PATH variable only contains SYSTEM values.
As pwsh.exe path is in USER PATH, check requirements script on CmdNotFound page load will fail
and as a result all requirements will be shown as missing.

Therefore, on loading, we manually set PATH variable, same as we do after installing pwsh7.
  • Loading branch information
stefansjfw committed May 17, 2024
1 parent e1832a0 commit c601a3e
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ private void InitializeEnabledValue()
_enabledStateIsGPOConfigured = true;
}

// Update PATH environment variable to get pwsh.exe on further calls.
Environment.SetEnvironmentVariable("PATH", (Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine) ?? string.Empty) + ";" + (Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty), EnvironmentVariableTarget.Process);

CheckCommandNotFoundRequirements();
}

Expand Down

0 comments on commit c601a3e

Please sign in to comment.