Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Files.Launcher/MessageHandlers/ApplicationLaunchHandler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Files.Common;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
Expand Down Expand Up @@ -91,6 +92,14 @@ private async void HandleApplicationLaunch(string application, Dictionary<string
else
{
process.StartInfo.Arguments = arguments;
// Refresh env variables for the child process
foreach (DictionaryEntry ent in Environment.GetEnvironmentVariables(EnvironmentVariableTarget.Machine))
process.StartInfo.EnvironmentVariables[(string)ent.Key] = (string)ent.Value;
Comment on lines +96 to +97
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to avoid #14101?

foreach (DictionaryEntry ent in Environment.GetEnvironmentVariables(EnvironmentVariableTarget.User))
process.StartInfo.EnvironmentVariables[(string)ent.Key] = (string)ent.Value;
process.StartInfo.EnvironmentVariables["PATH"] = string.Join(";",
Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine),
Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User));
}
process.StartInfo.WorkingDirectory = workingDirectory;
process.Start();
Expand Down