feat: add fallback message before exit

This commit is contained in:
phoenix 2025-04-17 06:55:36 +01:00
parent dfca4782bf
commit f27ca9c212

View File

@ -48,9 +48,17 @@ rw)
# Run tmux session inside the container
if ! podman exec -it --user "$USER" "$CONTAINER" tmux has-session -t "$TMUX_SESSION" 2>/dev/null; then
podman exec -it --user "$USER" "$CONTAINER" tmux new-session -s "$TMUX_SESSION"
if ! podman exec -it --user "$USER" "$CONTAINER" tmux new-session -s "$TMUX_SESSION"; then
echo "❌ Could not attach to tmux session. Please contact admin or try again later."
podman logs "$CONTAINER"
exit 1
fi
else
podman exec -it --user "$USER" "$CONTAINER" tmux attach -t "$TMUX_SESSION"
if ! podman exec -it --user "$USER" "$CONTAINER" tmux attach -t "$TMUX_SESSION"; then
echo "❌ Could not attach to tmux session. Please contact admin or try again later."
podman logs "$CONTAINER"
exit 1
fi
fi
check_devuser_attached
@ -58,7 +66,11 @@ rw)
;;
ro)
if podman container exists "$CONTAINER" && podman inspect -f '{{.State.Running}}' "$CONTAINER" | grep -q true; then
exec podman exec -it --user "$VIEW_USER" "$CONTAINER" tmux attach -r -t "$TMUX_SESSION"
if ! podman exec -it --user "$VIEW_USER" "$CONTAINER" tmux attach -r -t "$TMUX_SESSION"; then
echo "❌ Could not attach to tmux session. Please contact admin or try again later."
podman logs "$CONTAINER"
exit 1
fi
exit 0
else
echo "❌ Container $CONTAINER does not exist."