Skip to content

Commit

Permalink
Added an ExitCode to Autorest.exe (Azure#966)
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Hart authored and amarzavery committed Apr 22, 2016
1 parent ab9cb34 commit a7b6eb9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion AutoRest/AutoRest/AutoRest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<Compile Include="..\..\Tools\AssemblyVersionInfo.cs">
<Link>Properties\AssemblyVersionInfo.cs</Link>
</Compile>
<Compile Include="ExitCode.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="HelpExample.cs" />
<Compile Include="HelpGenerator.cs" />
Expand Down Expand Up @@ -70,4 +71,4 @@
</Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
14 changes: 14 additions & 0 deletions AutoRest/AutoRest/ExitCode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

namespace Microsoft.Rest.Generator.Cli
{
/// <summary>
/// Available exit codes.
/// </summary>
public enum ExitCode : int
{
Success = 0,
Error = 1
}
}
6 changes: 5 additions & 1 deletion AutoRest/AutoRest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ namespace Microsoft.Rest.Generator.Cli
{
internal class Program
{
private static void Main(string[] args)
private static int Main(string[] args)
{
int exitCode = (int)ExitCode.Error;

try
{
Settings settings = null;
Expand Down Expand Up @@ -69,6 +71,7 @@ private static void Main(string[] args)
{
Console.WriteLine(Resources.GenerationComplete,
settings.CodeGenerator, settings.Input);
exitCode = (int)ExitCode.Success;
}
}

Expand All @@ -91,6 +94,7 @@ private static void Main(string[] args)
Console.Error.WriteLine(Resources.ConsoleErrorMessage, exception.Message);
Console.Error.WriteLine(Resources.ConsoleErrorStackTrace, exception.StackTrace);
}
return exitCode;
}

/// <summary>
Expand Down

0 comments on commit a7b6eb9

Please sign in to comment.