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

Commit 6a9fa96

Browse files
authored
fix return code is always 0 (#1)
* fix return code is always 0 * allow unmatched property in YAML
1 parent 0822bae commit 6a9fa96

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/Microsoft.Content.Build.Code2Yaml.Steps/GenerateServiceMappingFile.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ select g
5959
{
6060
using (var reader = new StreamReader(outputPath))
6161
{
62-
var oldMapping = new YamlDeserializer().Deserialize<ServiceMapping>(reader);
62+
var oldMapping = new YamlDeserializer(ignoreUnmatched: true).Deserialize<ServiceMapping>(reader);
6363
foreach (var m in oldMapping[0].items)
6464
{
6565
if (m.name == "Other")

src/code2yaml/Program.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ class Program
1818
{
1919
private static ConfigModel _config;
2020

21-
static void Main(string[] args)
21+
static int Main(string[] args)
2222
{
2323
if (!ValidateConfig(args))
2424
{
25-
return;
25+
return 1;
2626
}
2727
var context = new BuildContext();
2828
context.SetSharedObject(Constants.Constants.Config, _config);
@@ -38,12 +38,12 @@ static void Main(string[] args)
3838
new GenerateArticles { Generator = ArticleGeneratorFactory.Create(_config.Language) },
3939
new GenerateServiceMappingFile()),
4040
}));
41-
string status = "Failed";
41+
var status = 1;
4242
var watch = Stopwatch.StartNew();
4343
try
4444
{
4545
procedure.RunAsync(context).Wait();
46-
status = "Succeeded";
46+
status = 0;
4747
}
4848
catch
4949
{
@@ -53,7 +53,9 @@ static void Main(string[] args)
5353
{
5454
watch.Stop();
5555
}
56-
Console.WriteLine($"{status} in {watch.ElapsedMilliseconds} milliseconds.");
56+
var statusString = status == 0 ? "Succeeded" : "Failed";
57+
Console.WriteLine($"{statusString} in {watch.ElapsedMilliseconds} milliseconds.");
58+
return status;
5759
}
5860

5961
private static bool ValidateConfig(string[] args)

0 commit comments

Comments
 (0)