public static string GetPathExecutable(string pathExecutable) { var locateExecutable = EnvironmentInfo.IsWin ? @"C:\Windows\System32\where.exe" : "/usr/bin/which"; var locateProcess = ProcessTasks.StartProcess( locateExecutable, pathExecutable, logOutput: false, logInvocation: false); locateProcess.AssertWaitForExit(); return(locateProcess.Output .Select(x => x.Text) .Where(x => EnvironmentInfo.IsWin && Path.HasExtension(x) || EnvironmentInfo.IsUnix) .FirstOrDefault(File.Exists) .NotNull($"Could not find '{pathExecutable}' via '{locateExecutable}'.")); }
public IReadOnlyCollection <Output> Execute( string arguments = null, string workingDirectory = null, IReadOnlyDictionary <string, string> environmentVariables = null, int?timeout = null, bool logOutput = true, Func <string, LogLevel> logLevelParser = null, Func <string, string> outputFilter = null) { var process = ProcessTasks.StartProcess( _toolPath, arguments, workingDirectory, environmentVariables, timeout, logOutput, logLevelParser, outputFilter); process.AssertZeroExitCode(); return(process.Output); }