From 3470942446527ba6b23ba0284eb01c677c4b4ae6 Mon Sep 17 00:00:00 2001 From: Robert E Date: Sun, 8 Sep 2024 13:13:28 +1000 Subject: [PATCH] Real error --- source/Calamari.FullFrameworkTools/Program.cs | 3 ++- .../Fixtures/Deployment/DeployPackageFixture.cs | 2 +- .../FullFramework/LegacyFrameworkInvoker.cs | 10 +++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source/Calamari.FullFrameworkTools/Program.cs b/source/Calamari.FullFrameworkTools/Program.cs index 3797b340e..0528dcbc6 100644 --- a/source/Calamari.FullFrameworkTools/Program.cs +++ b/source/Calamari.FullFrameworkTools/Program.cs @@ -20,7 +20,7 @@ public static int Main(string[] args) { var fileVersionInfo = FileVersionInfo.GetVersionInfo(typeof(Program).Assembly.Location); log.Info(fileVersionInfo.ProductVersion); - return 1; + return 0; } var commandLocator = new RequestTypeLocator(); @@ -34,6 +34,7 @@ public static int Main(string[] args) catch (Exception ex) { log.Fatal(ex); + return -1; } return 0; } diff --git a/source/Calamari.Tests/Fixtures/Deployment/DeployPackageFixture.cs b/source/Calamari.Tests/Fixtures/Deployment/DeployPackageFixture.cs index 577d82c34..41891a955 100644 --- a/source/Calamari.Tests/Fixtures/Deployment/DeployPackageFixture.cs +++ b/source/Calamari.Tests/Fixtures/Deployment/DeployPackageFixture.cs @@ -48,7 +48,7 @@ protected CalamariResult DeployPackage(string packageName) { Variables.Save(variablesFile.FilePath); - return Invoke(Calamari() + return InvokeInProcess(Calamari() .Action("deploy-package") .Argument("package", packageName) .Argument("variables", variablesFile.FilePath)); diff --git a/source/Calamari/Integration/FullFramework/LegacyFrameworkInvoker.cs b/source/Calamari/Integration/FullFramework/LegacyFrameworkInvoker.cs index 4b04ebe8c..1e4aebf1f 100644 --- a/source/Calamari/Integration/FullFramework/LegacyFrameworkInvoker.cs +++ b/source/Calamari/Integration/FullFramework/LegacyFrameworkInvoker.cs @@ -41,7 +41,8 @@ public TResponse Invoke(TRequest cmd) fileSystem.WriteAllBytes(file.FilePath, encRequestObj); var args = new[] { cmd.GetType().Name, "--password", password, "--file", file.FilePath }; - var taskResult = ""; + var taskResult = string.Empty; + var error = string.Empty; var processResult = SilentProcessRunner.ExecuteCommand(path, string.Join(" ", args), tempDir.DirectoryPath, @@ -70,12 +71,14 @@ public TResponse Invoke(TRequest cmd) Log.Error(line["Message"]?.ToString() ?? string.Empty); Log.Error(line["Type"]?.ToString() ?? string.Empty); Log.Error(line["StackTrace"]?.ToString() ?? string.Empty); - throw new Exception(line["Message"]?.ToString()); + error = line["Message"]?.ToString(); + throw new Exception(error); case LogLevel.Result: taskResult = line["Result"]?.ToString(); break; default: - throw new ArgumentOutOfRangeException(); + error = $"Unknown log level {logLevel}"; + break; } }, Log.Error); @@ -84,6 +87,7 @@ public TResponse Invoke(TRequest cmd) { throw new Exception("Operation failed: "+ processResult.ErrorOutput); } + return JsonConvert.DeserializeObject(taskResult); } }