Skip to content

Commit 54b6899

Browse files
gitfoolarturcic
authored andcommitted
Set application exit code
1 parent 43d9b8c commit 54b6899

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/GitVersionExe.Tests/ExecCmdLineArgumentTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void WorkingDirectoryDoesNotExistCrashesWithInformativeMessage()
9898
args,
9999
PathHelper.GetCurrentDirectory());
100100

101-
exitCode.ShouldBe(0);
101+
exitCode.ShouldNotBe(0);
102102
var outputString = output.ToString();
103103
outputString.ShouldContain($"The working directory '{workingDirectory}' does not exist.", () => outputString);
104104
}

src/GitVersionExe/GitVersionApp.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ public Task StartAsync(CancellationToken cancellationToken)
2727
{
2828
var arguments = options.Value;
2929
log.Verbosity = arguments.Verbosity;
30-
gitVersionExecutor.Execute(arguments);
30+
System.Environment.ExitCode = gitVersionExecutor.Execute(arguments);
3131
}
3232
catch (Exception exception)
3333
{
3434
Console.Error.WriteLine(exception.Message);
35+
System.Environment.ExitCode = 1;
3536
}
3637

3738
applicationLifetime.StopApplication();

0 commit comments

Comments
 (0)