ci::PkgmgrInstaller pkgmgr_installer;
tpk::TpkAppQueryInterface interface;
- ci::PkgMgrPtr pkgmgr = ci::PkgMgrInterface::Create(argc, argv,
- &pkgmgr_installer,
- &interface);
- if (!pkgmgr) {
- LOG(ERROR) << "Failed to create pkgmgr interface";
- return -1;
- }
+ try {
+ ci::PkgMgrPtr pkgmgr = ci::PkgMgrInterface::Create(argc, argv,
+ &pkgmgr_installer,
+ &interface);
+ if (!pkgmgr) {
+ LOG(ERROR) << "Failed to create pkgmgr interface";
+ return -1;
+ }
#if __cplusplus >= 201300L
- using std;
+ using std;
#endif
- ci::InstallerRunner runner(
- make_unique<tpk::TpkInstallerFactory>(), pkgmgr);
- ci::AppInstaller::Result result = runner.Run();
-
- return (result == ci::AppInstaller::Result::OK) ? 0 : 1;
+ ci::InstallerRunner runner(
+ make_unique<tpk::TpkInstallerFactory>(), pkgmgr);
+ ci::AppInstaller::Result result = runner.Run();
+ return (result == ci::AppInstaller::Result::OK) ? 0 : 1;
+ } catch(...) {
+ LOG(ERROR) << "Exception occured";
+ return 1;
+ }
}