Skip to content

Commit

Permalink
Adds a try-catch around code that reads PATH environment variable, ca…
Browse files Browse the repository at this point in the history
  • Loading branch information
daveaglick committed Oct 17, 2016
1 parent e70964f commit 613ce32
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Cake.Core/Tooling/ToolResolutionStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,16 @@ private List<DirectoryPath> GetPathDirectories()
{
var separator = new[] { _environment.Platform.IsUnix() ? ':' : ';' };
var paths = path.Split(separator, StringSplitOptions.RemoveEmptyEntries);
result.AddRange(paths.Select(p => new DirectoryPath(p)));
foreach (var p in paths)
{
try
{
result.Add(new DirectoryPath(p.Trim(' ', '"', '\'')));
}
catch
{
}
}
}

return result;
Expand Down

0 comments on commit 613ce32

Please sign in to comment.