diff --git a/CHANGELOG.md b/CHANGELOG.md index 214e72be..c62b6a48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2 ### Fixed - Fixed crash when clicking "Remind me Later" on the update dialog - Fixed some cases of crashing when GitHub API rate limits are exceeded +- Fixed Git missing from env vars when running SwarmUI ### Supporters #### Visionaries - A huge thank you to our dedicated Visionary-tier Patreon supporter, **Waterclouds**! We’re thrilled to have your ongoing support! diff --git a/StabilityMatrix.Core/Models/Packages/StableSwarm.cs b/StabilityMatrix.Core/Models/Packages/StableSwarm.cs index 950c398b..1194f06c 100644 --- a/StabilityMatrix.Core/Models/Packages/StableSwarm.cs +++ b/StabilityMatrix.Core/Models/Packages/StableSwarm.cs @@ -257,13 +257,24 @@ public override async Task RunPackage( CancellationToken cancellationToken = default ) { + var portableGitBin = new DirectoryPath(PrerequisiteHelper.GitBinPath); var aspEnvVars = new Dictionary { ["ASPNETCORE_ENVIRONMENT"] = "Production", - ["ASPNETCORE_URLS"] = "http://*:7801" + ["ASPNETCORE_URLS"] = "http://*:7801", + ["GIT"] = portableGitBin.JoinFile("git.exe") }; aspEnvVars.Update(settingsManager.Settings.EnvironmentVariables); + if (aspEnvVars.TryGetValue("PATH", out var pathValue)) + { + aspEnvVars["PATH"] = Compat.GetEnvPathWithExtensions(portableGitBin, pathValue); + } + else + { + aspEnvVars["PATH"] = Compat.GetEnvPathWithExtensions(portableGitBin); + } + void HandleConsoleOutput(ProcessOutput s) { onConsoleOutput?.Invoke(s);