winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 8340ee2738b2cb73f5f69db425e96705b35675a6
parent b6678600b294cfb1ac5b74524b914daf23845103
Author: JohnMcPMS <johnmcp@microsoft.com>
Date:   Tue, 12 Apr 2022 15:38:23 -0700

Fix exceptions breaking out of the multi-package install loop (#2089)

Wrap the subexecution with a try/catch to prevent exceptions from breaking out of the mult-package install loop.
Diffstat:
Msrc/AppInstallerCLICore/Workflows/InstallFlow.cpp | 17+++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/AppInstallerCLICore/Workflows/InstallFlow.cpp b/src/AppInstallerCLICore/Workflows/InstallFlow.cpp @@ -438,12 +438,21 @@ namespace AppInstaller::CLI::Workflow auto previousThreadGlobals = installContext.SetForCurrentThread(); installContext << Workflow::ReportIdentityAndInstallationDisclaimer; - if (!m_ignorePackageDependencies) + + // Prevent individual exceptions from breaking out of the loop + try + { + if (!m_ignorePackageDependencies) + { + installContext << Workflow::ManagePackageDependencies(m_dependenciesReportMessage); + } + installContext << Workflow::DownloadInstaller; + installContext << Workflow::InstallPackageInstaller; + } + catch (...) { - installContext << Workflow::ManagePackageDependencies(m_dependenciesReportMessage); + installContext.SetTerminationHR(Workflow::HandleException(installContext, std::current_exception())); } - installContext << Workflow::DownloadInstaller; - installContext << Workflow::InstallPackageInstaller; installContext.Reporter.Info() << std::endl;