diff --git a/src/main.cc b/src/main.cc index a83ebe74..84cf162b 100644 --- a/src/main.cc +++ b/src/main.cc @@ -526,7 +526,7 @@ int run_client(StringView session, StringView name, StringView client_init, client_init, std::move(init_coord)}; if (suspend) raise(SIGTSTP); - while (not client.exit_status()) + while (not client.exit_status() and client.is_ui_ok()) event_manager.handle_next_events(EventMode::Normal); return *client.exit_status(); } diff --git a/src/remote.cc b/src/remote.cc index c5c04915..da441bd8 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -668,6 +668,11 @@ RemoteClient::RemoteClient(StringView session, StringView name, std::unique_ptr< }}); } +bool RemoteClient::is_ui_ok() const +{ + return m_ui->is_ok(); +} + void send_command(StringView session, StringView command) { int sock = connect_to(session); diff --git a/src/remote.hh b/src/remote.hh index a8056fca..19eb0071 100644 --- a/src/remote.hh +++ b/src/remote.hh @@ -34,6 +34,7 @@ public: int pid, const EnvVarMap& env_vars, StringView init_command, Optional init_coord); + bool is_ui_ok() const; const Optional& exit_status() const { return m_exit_status; } private: std::unique_ptr m_ui;