diff --git a/src/AppInstallerCLICore/Workflows/ShellExecuteInstallerHandler.cpp b/src/AppInstallerCLICore/Workflows/ShellExecuteInstallerHandler.cpp index ddf24367d7..711db695f0 100644 --- a/src/AppInstallerCLICore/Workflows/ShellExecuteInstallerHandler.cpp +++ b/src/AppInstallerCLICore/Workflows/ShellExecuteInstallerHandler.cpp @@ -138,6 +138,7 @@ namespace AppInstaller::CLI::Workflow { context.Reporter.Info() << "Installing ..." << std::endl; + const auto& installer = context.Get(); const std::string& installerArgs = context.Get(); auto installResult = context.Reporter.ExecuteWithProgress( @@ -151,7 +152,7 @@ namespace AppInstaller::CLI::Workflow context.Reporter.Warn() << "Installation abandoned" << std::endl; AICLI_TERMINATE_CONTEXT(E_ABORT); } - else if (installResult.value() != 0) + else if (installResult.value() != installer->SuccessExitCode) { const auto& manifest = context.Get(); Logging::Telemetry().LogInstallerFailure(manifest.Id, manifest.Version, manifest.Channel, "ShellExecute", installResult.value()); diff --git a/src/AppInstallerRepositoryCore/Manifest/ManifestInstaller.cpp b/src/AppInstallerRepositoryCore/Manifest/ManifestInstaller.cpp index b3beaca1e8..b47e2af927 100644 --- a/src/AppInstallerRepositoryCore/Manifest/ManifestInstaller.cpp +++ b/src/AppInstallerRepositoryCore/Manifest/ManifestInstaller.cpp @@ -15,6 +15,7 @@ namespace AppInstaller::Manifest YAML::Node switchesNode; this->InstallerType = defaultInstaller.InstallerType; this->Scope = "user"; + this->SuccessExitCode = 0; std::vector fieldInfos; @@ -30,6 +31,7 @@ namespace AppInstaller::Manifest { "Scope", [this](const YAML::Node& value) { Scope = value.as(); } }, { "InstallerType", [this](const YAML::Node& value) { InstallerType = ConvertToInstallerTypeEnum(value.as()); } }, { "Switches", [&](const YAML::Node& value) { switchesNode = value; } }, + { "SuccessExitCode", [&](const YAML::Node& value) { SuccessExitCode = value.as(); } }, }; std::move(previewFieldInfos.begin(), previewFieldInfos.end(), std::inserter(fieldInfos, fieldInfos.end())); diff --git a/src/AppInstallerRepositoryCore/Manifest/ManifestInstaller.h b/src/AppInstallerRepositoryCore/Manifest/ManifestInstaller.h index cdc86f4f6f..0ee1d408bf 100644 --- a/src/AppInstallerRepositoryCore/Manifest/ManifestInstaller.h +++ b/src/AppInstallerRepositoryCore/Manifest/ManifestInstaller.h @@ -71,6 +71,9 @@ namespace AppInstaller::Manifest // If present, has more precedence than root std::map Switches; + // Optional. Default is zero. + DWORD SuccessExitCode; + static InstallerTypeEnum ConvertToInstallerTypeEnum(const std::string& in); static std::map GetDefaultKnownSwitches(InstallerTypeEnum installerType);