Skip to content

Commit

Permalink
Merge pull request #90 from rgregg/ignore-errors
Browse files Browse the repository at this point in the history
Add ability to ignore errors
  • Loading branch information
rgregg committed Feb 23, 2016
2 parents 9c2e306 + 793fc03 commit fd6f0a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ApiDocs.Console/CommandLineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ class BaseOptions
[Option("appveyor-url", HelpText="Specify the AppVeyor Build Worker API URL for output integration")]
public string AppVeyorServiceUrl { get; set; }

[Option("ignore-errors", HelpText="Prevent errors from generating a non-zero return code.")]
public bool IgnoreErrors { get; set; }

#if DEBUG
[Option("debug", HelpText="Launch the debugger before doing anything interesting")]
public bool AttachDebugger { get; set; }
Expand Down
11 changes: 11 additions & 0 deletions ApiDocs.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class Program
public static readonly BuildWorkerApi BuildWorker = new BuildWorkerApi();
public static AppConfigFile CurrentConfiguration { get; private set; }

// Set to true to disable returning an error code when the app exits.
private static bool IgnoreErrors { get; set; }

static void Main(string[] args)
{
Logging.ProviderLogger(new ConsoleAppLogger());
Expand All @@ -80,6 +83,7 @@ static void Main(string[] args)
Exit(failure: true);
}

IgnoreErrors = verbOptions.IgnoreErrors;
#if DEBUG
if (verbOptions.AttachDebugger)
{
Expand Down Expand Up @@ -989,6 +993,13 @@ private static void Exit(bool failure, int? customExitCode = null)
{
exitCode = customExitCode.Value;
}

if (IgnoreErrors)
{
FancyConsole.WriteLine("Ignoring errors and returning a successful exit code.");
exitCode = ExitCodeSuccess;
}

#if DEBUG
Console.WriteLine("Exit code: " + exitCode);
if (Debugger.IsAttached)
Expand Down

0 comments on commit fd6f0a5

Please sign in to comment.