Skip to content

Commit

Permalink
Merge pull request #880 from solidify/feature/return-code-2
Browse files Browse the repository at this point in the history
Ensure return code is returned from the application. Use error code -1
  • Loading branch information
Alexander-Hjelm authored Oct 9, 2023
2 parents e40f162 + 2b9defc commit 1c02aa1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/WorkItemMigrator/JiraExport/JiraCommandLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private void ConfigureCommandLineParserWithOptions()
commandLineApplication.ShowHelp();
}

return succeeded ? 0 : 1;
return succeeded ? 0 : -1;
});
}

Expand Down Expand Up @@ -267,9 +267,9 @@ private static void EndSession(int itemsCount, Stopwatch sw)
{ "elapsed-time", string.Format("{0:hh\\:mm\\:ss}", sw.Elapsed) }});
}

public void Run()
public int Run()
{
commandLineApplication.Execute(args);
return commandLineApplication.Execute(args);
}
}
}
5 changes: 3 additions & 2 deletions src/WorkItemMigrator/JiraExport/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ namespace JiraExport
{
static class Program
{
static void Main(string[] args)
static int Main(string[] args)
{
VersionInfo.PrintInfoMessage("Jira Exporter");

try
{
var cmd = new JiraCommandLine(args);
cmd.Run();
return cmd.Run();
}
catch (Exception ex)
{
Logger.Log(ex, "Application stopped due to an unexpected exception", LogLevel.Critical);
return -1;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/WorkItemMigrator/WorkItemImport/ImportCommandLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public ImportCommandLine(params string[] args)
InitCommandLine(args);
}

public void Run()
public int Run()
{
commandLineApplication.Execute(args);
return commandLineApplication.Execute(args);
}

private void InitCommandLine(params string[] args)
Expand Down Expand Up @@ -61,7 +61,7 @@ private void ConfigureCommandLineParserWithOptions()
commandLineApplication.ShowHelp();
}

return succeeded ? 0 : 1;
return succeeded ? 0 : -1;
});
}

Expand Down
3 changes: 2 additions & 1 deletion src/WorkItemMigrator/WorkItemImport/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ static void Main(string[] args)
try
{
var cmd = new ImportCommandLine(args);
cmd.Run();
return cmd.Run();
}
catch (Exception ex)
{
Logger.Log(ex, "Application stopped due to an unexpected exception", LogLevel.Critical);
return -1;
}
}
}
Expand Down

0 comments on commit 1c02aa1

Please sign in to comment.