feat(reset): stop when a selected container publishes no port for the emulator

A selected container that is running without a matching published port has nothing to be found by, and the configured endpoint may be another instance.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura committed 2026-10-10 21:51:42 -05:00
1 parent c95d2ffb16
commit 11de360c11
3 files changed
+49 -5

No files matched your search

@@ -109,7 +109,13 @@ public class ResetCommand implements Callable<Integer> {
return new Target(null, "Container '" + global.container + "' is not running (state: "
+ info.get().state() + "), so nothing was reset." + how);
}
return new Target(global.endpointFromPorts(info.get().ports(), global.endpoint), null);
Optional<String> published = global.publishedEndpoint(info.get().ports(), global.endpoint);
if (chosen && published.isEmpty()) {
// No port to find it by: the configured endpoint may well be another instance.
return new Target(null, "Container '" + global.container
+ "' publishes no port for the emulator, so nothing was reset." + how);
}
return new Target(published.orElse(global.endpoint), null);
}
@Override