Skip to content

Commit

Permalink
Add support for 64 bit git, and don't add non-existing folders to PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
davidebbo committed Apr 16, 2018
1 parent cb2ed2e commit 1af9a4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Kudu.Core/Infrastructure/PathUtils/PathWindowsUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ internal override string[] ResolveGitToolPaths()
{
// as of git 2.8.1, various unix tools are installed in multiple paths.
// add them to %path%.
// As of git 2.14.1 curl no longer exists in usr/bin. Use the one from mingw32/bin instead
// As of git 2.14.1 curl no longer exists in usr/bin. Use the one from mingw32/bin (mingw64/bin) instead
// We add both mingw32 and mingw64, but it will only end up adding those that actually exist to the PATH
string gitPath = ResolveGitInstallDirPath();
return new[]
{
Path.Combine(gitPath, "bin"),
Path.Combine(gitPath, "usr", "bin"),
Path.Combine(gitPath, "mingw32", "bin")
Path.Combine(gitPath, "mingw32", "bin"),
Path.Combine(gitPath, "mingw64", "bin")
};
}

Expand Down
5 changes: 4 additions & 1 deletion Kudu.Services.Web/App_Start/NinjectServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http.Formatting;
using System.Web;
Expand Down Expand Up @@ -757,7 +758,9 @@ private static void PrependFoldersToPath(IEnvironment environment)
List<string> folders = PathUtilityFactory.Instance.GetPathFolders(environment);

string path = System.Environment.GetEnvironmentVariable("PATH");
string additionalPaths = String.Join(Path.PathSeparator.ToString(), folders);

// Ignore any folder that doesn't actually exist
string additionalPaths = String.Join(Path.PathSeparator.ToString(), folders.Where(dir => Directory.Exists(dir)));

// Make sure we haven't already added them. This can happen if the Kudu appdomain restart (since it's still same process)
if (!path.Contains(additionalPaths))
Expand Down

0 comments on commit 1af9a4c

Please sign in to comment.