Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/GitVersionExe.Tests/ExecCmdLineArgumentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,16 @@ public void CheckBuildServerVerbosityConsole(string verbosityArg, string expecte
}

[Test]
public void WorkingDirectoryWithoutGitFolderCrashesWithInformativeMessage()
public void WorkingDirectoryWithoutGitFolderFailsWithInformativeMessage()
{
var results = GitVersionHelper.ExecuteIn(Environment.SystemDirectory, null, false);
results.Output.ShouldContain("Can't find the .git directory in");
var result = GitVersionHelper.ExecuteIn(Environment.SystemDirectory, null, false);

result.ExitCode.ShouldNotBe(0);
result.Output.ShouldContain("Can't find the .git directory in");
}

[Test]
public void WorkingDirectoryDoesNotExistCrashesWithInformativeMessage()
public void WorkingDirectoryDoesNotExistFailsWithInformativeMessage()
{
var workingDirectory = Path.Combine(PathHelper.GetCurrentDirectory(), Guid.NewGuid().ToString("N"));
var executable = PathHelper.GetExecutable();
Expand All @@ -98,7 +100,7 @@ public void WorkingDirectoryDoesNotExistCrashesWithInformativeMessage()
args,
PathHelper.GetCurrentDirectory());

exitCode.ShouldBe(0);
exitCode.ShouldNotBe(0);
var outputString = output.ToString();
outputString.ShouldContain($"The working directory '{workingDirectory}' does not exist.", () => outputString);
}
Expand Down
3 changes: 2 additions & 1 deletion src/GitVersionExe/GitVersionApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ public Task StartAsync(CancellationToken cancellationToken)
{
var arguments = options.Value;
log.Verbosity = arguments.Verbosity;
gitVersionExecutor.Execute(arguments);
System.Environment.ExitCode = gitVersionExecutor.Execute(arguments);
}
catch (Exception exception)
{
Console.Error.WriteLine(exception.Message);
System.Environment.ExitCode = 1;
}

applicationLifetime.StopApplication();
Expand Down