Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Commit

Permalink
fix return code is always 0 (#1)
Browse files Browse the repository at this point in the history
* fix return code is always 0

* allow unmatched property in YAML
  • Loading branch information
superyyrrzz authored Jun 30, 2017
1 parent 0822bae commit 6a9fa96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ select g
{
using (var reader = new StreamReader(outputPath))
{
var oldMapping = new YamlDeserializer().Deserialize<ServiceMapping>(reader);
var oldMapping = new YamlDeserializer(ignoreUnmatched: true).Deserialize<ServiceMapping>(reader);
foreach (var m in oldMapping[0].items)
{
if (m.name == "Other")
Expand Down
12 changes: 7 additions & 5 deletions src/code2yaml/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class Program
{
private static ConfigModel _config;

static void Main(string[] args)
static int Main(string[] args)
{
if (!ValidateConfig(args))
{
return;
return 1;
}
var context = new BuildContext();
context.SetSharedObject(Constants.Constants.Config, _config);
Expand All @@ -38,12 +38,12 @@ static void Main(string[] args)
new GenerateArticles { Generator = ArticleGeneratorFactory.Create(_config.Language) },
new GenerateServiceMappingFile()),
}));
string status = "Failed";
var status = 1;
var watch = Stopwatch.StartNew();
try
{
procedure.RunAsync(context).Wait();
status = "Succeeded";
status = 0;
}
catch
{
Expand All @@ -53,7 +53,9 @@ static void Main(string[] args)
{
watch.Stop();
}
Console.WriteLine($"{status} in {watch.ElapsedMilliseconds} milliseconds.");
var statusString = status == 0 ? "Succeeded" : "Failed";
Console.WriteLine($"{statusString} in {watch.ElapsedMilliseconds} milliseconds.");
return status;
}

private static bool ValidateConfig(string[] args)
Expand Down

0 comments on commit 6a9fa96

Please sign in to comment.