Skip to content

Commit 844101b

Browse files
committed
(build) minor
1 parent 1370560 commit 844101b

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

build.cake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Task("Format")
221221
{
222222
var dotnetFormatExe = Context.Tools.Resolve("dotnet-format.exe");
223223
var args = $"--folder {parameters.Paths.Directories.Root}";
224-
StartProcess(dotnetFormatExe, args);
224+
Context.ExecuteCommand(dotnetFormatExe, args);
225225
});
226226

227227
Task("Default")

build/utils/utils.cake

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,19 @@ public static bool IsEnabled(this ICakeContext context, string envVar, bool null
7676
return string.IsNullOrWhiteSpace(value) ? nullOrEmptyAsEnabled : bool.Parse(value);
7777
}
7878

79-
public static List<string> ExecGitCmd(this ICakeContext context, string cmd)
79+
public static List<string> ExecuteCommand(this ICakeContext context, FilePath exe, string args)
8080
{
81-
var gitPath = context.Tools.Resolve(context.IsRunningOnWindows() ? "git.exe" : "git");
82-
context.StartProcess(gitPath, new ProcessSettings { Arguments = cmd, RedirectStandardOutput = true }, out var redirectedOutput);
81+
context.StartProcess(exe, new ProcessSettings { Arguments = args, RedirectStandardOutput = true }, out var redirectedOutput);
8382

8483
return redirectedOutput.ToList();
8584
}
8685

86+
public static List<string> ExecGitCmd(this ICakeContext context, string cmd)
87+
{
88+
var gitExe = context.Tools.Resolve(context.IsRunningOnWindows() ? "git.exe" : "git");
89+
return context.ExecuteCommand(gitExe, cmd);
90+
}
91+
8792
DirectoryPath HomePath()
8893
{
8994
return IsRunningOnWindows()
@@ -124,16 +129,9 @@ GitVersion GetVersion(BuildParameters parameters)
124129
void ValidateVersion(BuildParameters parameters)
125130
{
126131
var gitVersionTool = GetFiles($"artifacts/**/bin/{parameters.CoreFxVersion31}/gitversion.dll").FirstOrDefault();
127-
IEnumerable<string> output;
128-
var fullFxResult = StartProcess(
129-
"dotnet",
130-
new ProcessSettings {
131-
Arguments = $"\"{gitVersionTool}\" -version",
132-
RedirectStandardOutput = true,
133-
},
134-
out output
135-
);
132+
var dotnetExe = Context.Tools.Resolve("dotnet");
136133

134+
var output = Context.ExecuteCommand("dotnet", $"\"{gitVersionTool}\" -version");
137135
var outputStr = string.Concat(output);
138136

139137
Assert.Equal(parameters.Version.GitVersion.InformationalVersion, outputStr);

0 commit comments

Comments
 (0)