Refresh PATH in configuration remoting server#5511
Refresh PATH in configuration remoting server#5511yao-msft merged 4 commits intomicrosoft:masterfrom
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
JohnMcPMS
left a comment
There was a problem hiding this comment.
Please confirm that the server process exits cleanly when the client completes.
| /// </summary> | ||
| public static void UpdatePath() | ||
| { | ||
| List<string> paths = new List<string>(Environment.GetEnvironmentVariable(PathEnvironmentVariable)?.Split(';') ?? Array.Empty<string>()); |
There was a problem hiding this comment.
Should this be a HashSet<string> to make the looped Contains calls in AddPathsIfNotExist more efficient?
| { | ||
| if (!currentPaths.Contains(path)) | ||
| { | ||
| currentPaths.Add(path); |
There was a problem hiding this comment.
This always adds to the end, making it the last location to look. That may cause issues in some corner case; probably ok for now but maybe add a comment.
The "proper" thing to do would probably be to calculate the full new list of paths (what one would expect to get from a new process launch) and use a line merge algorithm with a strategy that puts the ephemeral entries before the new permanent ones. But that is a fair bit more complicated and could wait until later.
I can confirm ConfigurationRemotingServer.exe exits right after configuration completes. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Added a hidden window to listen for UserPreferenceChanged event (WM_SETTINGCHANGE) and update the process's PATH if needed.
Manually validated by running a configuration file with multiple resources, change the env var during the run, and verified in logs file that new path got included in runs after the change.
Microsoft Reviewers: Open in CodeFlow