fix: Add error handling for scenarios where tmux is unavailable (#8043)

Co-authored-by: Anuradha Weeraman <anuradha@verdentra.com>
This commit is contained in:
Panduka Muditha 2025-04-24 00:31:06 +05:30 committed by GitHub
parent 964478c22f
commit 3c4ebc3d8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -38,6 +38,7 @@ check-dependencies:
ifeq ($(INSTALL_DOCKER),)
@$(MAKE) -s check-docker
endif
@$(MAKE) -s check-tmux
@$(MAKE) -s check-poetry
@echo "$(GREEN)Dependencies checked successfully.$(RESET)"
@ -101,6 +102,15 @@ check-docker:
exit 1; \
fi
check-tmux:
@echo "$(YELLOW)Checking tmux installation...$(RESET)"
@if command -v tmux > /dev/null; then \
echo "$(BLUE)$(shell tmux -V) is already installed.$(RESET)"; \
else \
echo "$(RED)tmux is not installed. Please install tmux to continue.$(RESET)"; \
exit 1; \
fi
check-poetry:
@echo "$(YELLOW)Checking Poetry installation...$(RESET)"
@if command -v poetry > /dev/null; then \

View File

@ -68,7 +68,10 @@ def check_dependencies(code_repo_path: str, poetry_venvs_path: str):
import libtmux
server = libtmux.Server()
session = server.new_session(session_name='test-session')
try:
session = server.new_session(session_name='test-session')
except Exception as e:
raise ValueError('tmux is not properly installed or available on the path.')
pane = session.attached_pane
pane.send_keys('echo "test"')
pane_output = '\n'.join(pane.cmd('capture-pane', '-p').stdout)