Reap final-session coordinator before returning

This commit is contained in:
ms2k 2026-08-02 20:27:08 +09:00
commit 2df810f125

View file

@ -423,12 +423,22 @@ impl ClientBackend for CoordinatorClientBackend {
execute_over_control_face_as(&endpoint, argv, stdout, stderr, &self.identity)?
};
self.bootstrap_owner.take();
if let Some(coordinator) = self.coordinator.take()
&& coordinator
let reap_coordinator = if let Some(coordinator) = self.coordinator.as_ref() {
!matches!(
self.discover().map_err(ClientError::Backend)?,
Discovery::Ready(_)
) || coordinator
.has_exited()
.map_err(failure)
.map_err(ClientError::Backend)?
{
} else {
false
};
if reap_coordinator {
let coordinator = self
.coordinator
.take()
.expect("checked coordinator remains present");
let status = coordinator
.reap()
.map_err(failure)