int main(int argc, char** argv) {
ci::PkgmgrInstaller pkgmgr_installer;
wgt::WgtAppQueryInterface query_interface;
- auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer,
- &query_interface);
- std::unique_ptr<ci::InstallerFactory> installer_factory;
- if (!pkgmgr) {
- LOG(ERROR) << "Options of pkgmgr installer cannot be parsed";
- return EINVAL;
- }
+ try {
+ auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer,
+ &query_interface);
+ std::unique_ptr<ci::InstallerFactory> installer_factory;
+ if (!pkgmgr) {
+ LOG(ERROR) << "Options of pkgmgr installer cannot be parsed";
+ return EINVAL;
+ }
#if __cplusplus >= 201300L
- using std;
+ using std;
#endif
- // This is workaround for hybrid apps as they requires much different flow
- // but installer does not branch at all in current design
- if (query_interface.IsHybridApplication(
- pkgmgr->GetRequestInfo(), pkgmgr->GetUid())) {
- LOG(INFO) << "Hybrid package detected";
- ci::InstallerRunner runner(
- make_unique<hybrid::HybridInstallerFactory>(), pkgmgr);
- return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
- } else {
- ci::InstallerRunner runner(make_unique<wgt::WgtInstallerFactory>(), pkgmgr);
- return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
+ // This is workaround for hybrid apps as they requires much different flow
+ // but installer does not branch at all in current design
+ if (query_interface.IsHybridApplication(
+ pkgmgr->GetRequestInfo(), pkgmgr->GetUid())) {
+ LOG(INFO) << "Hybrid package detected";
+ ci::InstallerRunner runner(
+ make_unique<hybrid::HybridInstallerFactory>(), pkgmgr);
+ return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
+ } else {
+ ci::InstallerRunner runner(
+ make_unique<wgt::WgtInstallerFactory>(), pkgmgr);
+ return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
+ }
+ } catch(...) {
+ LOG(ERROR) << "Exception occured";
+ return 1;
}
}