mirror of
https://github.com/actions/runner.git
synced 2025-12-11 04:46:58 +00:00
shell from prependpath (#231)
* Prepend path before locating shell tool * Join optional prepended path to path before searching it * Use prepended path when whiching shell tool * Addition prependPath location * Also use prepended paths when writing out run details * Small tweak to undo unnecessary change
This commit is contained in:
@@ -7,7 +7,7 @@ namespace GitHub.Runner.Sdk
|
||||
{
|
||||
public static class WhichUtil
|
||||
{
|
||||
public static string Which(string command, bool require = false, ITraceWriter trace = null)
|
||||
public static string Which(string command, bool require = false, ITraceWriter trace = null, string prependPath = null)
|
||||
{
|
||||
ArgUtil.NotNullOrEmpty(command, nameof(command));
|
||||
trace?.Info($"Which: '{command}'");
|
||||
@@ -17,6 +17,10 @@ namespace GitHub.Runner.Sdk
|
||||
trace?.Info("PATH environment variable not defined.");
|
||||
path = path ?? string.Empty;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(prependPath))
|
||||
{
|
||||
path = PathUtil.PrependPath(prependPath, path);
|
||||
}
|
||||
|
||||
string[] pathSegments = path.Split(new Char[] { Path.PathSeparator }, StringSplitOptions.RemoveEmptyEntries);
|
||||
for (int i = 0; i < pathSegments.Length; i++)
|
||||
|
||||
Reference in New Issue
Block a user