diff --git a/src/anbox/cmds/launch.cpp b/src/anbox/cmds/launch.cpp index 16f71dd..afbd2ab 100644 --- a/src/anbox/cmds/launch.cpp +++ b/src/anbox/cmds/launch.cpp @@ -88,8 +88,8 @@ anbox::cmds::Launch::Launch() const auto snap_path = utils::get_env_value("SNAP"); if (!snap_path.empty()) { - const auto resource_path = utils::string_format("%s/usr/share/anbox", snap_path); - SystemConfiguration::instance().set_resource_path(resource_path); + const auto resource_path = fs::path(snap_path) / "usr" / "share" / "anbox"; + SystemConfiguration::instance().set_resource_path(resource_path.string()); } std::shared_ptr ss; @@ -126,12 +126,17 @@ anbox::cmds::Launch::Launch() } try { - const auto flags = core::posix::StandardStream::empty; // core::posix::StandardStream::stdout | core::posix::StandardStream::stderr; + const auto flags = core::posix::StandardStream::stdout | core::posix::StandardStream::stderr; auto child = core::posix::fork([&]() { auto grandchild = core::posix::exec(exe_path, args, env, flags); grandchild.dont_kill_on_cleanup(); return core::posix::exit::Status::success; }, flags); + + // We don't wait for the grandchild but the child as we use double forking + // here to break through the process hierarchy and make the grandchild a + // direct child of the init process so it keeps running on its own and + // indepent of our short living process here. child.wait_for(core::posix::wait::Flags::untraced); DEBUG("Started session manager, will now try to connect .."); @@ -173,8 +178,10 @@ anbox::cmds::Launch::Launch() boost::asio::deadline_timer timer(rt->service()); timer.expires_from_now(max_wait_timeout); timer.async_wait([&](const boost::system::error_code&) { - WARNING("Stopped waiting as we're already waited for too long. Something"); + WARNING("Stopped waiting as we've already waited for too long. Something"); WARNING("is wrong with your setup or the container has failed to boot."); + WARNING("If you think you found a bug please don't hesitate to file on"); + WARNING("at https://github.com/anbox/anbox/issues/new"); trap->stop(); }); diff --git a/src/anbox/config.cpp b/src/anbox/config.cpp index d6be507..a13aa43 100644 --- a/src/anbox/config.cpp +++ b/src/anbox/config.cpp @@ -41,7 +41,7 @@ void anbox::SystemConfiguration::set_data_path(const std::string &path) { data_path = path; } -void anbox::SystemConfiguration::set_resource_path(const std::string &path) { +void anbox::SystemConfiguration::set_resource_path(const fs::path &path) { resource_path = path; } diff --git a/src/anbox/config.h b/src/anbox/config.h index e3417d8..47a518e 100644 --- a/src/anbox/config.h +++ b/src/anbox/config.h @@ -31,7 +31,7 @@ class SystemConfiguration { virtual ~SystemConfiguration() = default; void set_data_path(const std::string &path); - void set_resource_path(const std::string &path); + void set_resource_path(const boost::filesystem &path); boost::filesystem::path data_dir() const; std::string rootfs_dir() const; diff --git a/src/anbox/ui/splash_screen.cpp b/src/anbox/ui/splash_screen.cpp index d40ebf5..b52c817 100644 --- a/src/anbox/ui/splash_screen.cpp +++ b/src/anbox/ui/splash_screen.cpp @@ -82,12 +82,7 @@ void SplashScreen::process_events() { while (event_thread_running_) { SDL_Event event; while (SDL_WaitEventTimeout(&event, 100)) { - switch (event.type) { - case SDL_QUIT: - break; - default: - break; - } + // Keep running until we're terminated } } }