Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative return codes don't work in Linux #5

Open
johnsimons opened this issue Jun 24, 2019 · 1 comment
Open

Negative return codes don't work in Linux #5

johnsimons opened this issue Jun 24, 2019 · 1 comment

Comments

@johnsimons
Copy link
Contributor

There are quite a few return codes in

static int PrintError(Exception ex)
{
var agg = ex as AggregateException;
if (agg != null)
{
var errors = new HashSet<Exception>(agg.InnerExceptions);
if (agg.InnerException != null)
errors.Add(ex.InnerException);
var lastExit = 0;
foreach (var inner in errors)
{
lastExit = PrintError(inner);
}
return lastExit;
}
var securityException = ex as OctopusSecurityException;
if (securityException != null)
{
if (!string.IsNullOrWhiteSpace(securityException.HelpText))
{
Log.Error(securityException.HelpText);
}
Log.Error(securityException.Message);
return -5;
}
var cmd = ex as CommandException;
if (cmd != null)
{
Log.Error(ex.Message);
if (LogExtensions.IsKnownEnvironment())
{
Log.Error("This error is most likely occurring while executing Octo.exe as part of an automated build process. The following doc is recommended to get some tips on how to troubleshoot this: https://g.octopushq.com/OctoexeTroubleshooting");
}
return -1;
}
var reflex = ex as ReflectionTypeLoadException;
if (reflex != null)
{
Log.Error(ex, string.Empty);
foreach (var loaderException in reflex.LoaderExceptions)
{
Log.Error(loaderException, string.Empty);
}
return -43;
}
var octo = ex as OctopusException;
if (octo != null)
{
Log.Information("{HttpErrorMessage:l}", octo.Message);
Log.Error("Error from Octopus Server (HTTP {StatusCode} {StatusDescription})", octo.HttpStatusCode, (HttpStatusCode) octo.HttpStatusCode);
return -7;
}
Log.Error(ex, string.Empty);
return -3;
}
that will overflow in Linux.

These should be positive (byte) numbers.

@MattAlex151
Copy link

+1, just ran into this when our build system passed a build despite octo.exe returning -3.
We'll add an additional check to fix this on our side, but would be nice to just have positive exit codes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants