Skip to content

feat: implement interactive_custom_command for mid-execution user prompts#22

Draft
KarolinaPomian wants to merge 1 commit intointel:mainfrom
KarolinaPomian:interactive_custom_command
Draft

feat: implement interactive_custom_command for mid-execution user prompts#22
KarolinaPomian wants to merge 1 commit intointel:mainfrom
KarolinaPomian:interactive_custom_command

Conversation

@KarolinaPomian
Copy link
Copy Markdown

@KarolinaPomian KarolinaPomian commented Apr 8, 2026

This pull request introduces support for interactive command execution in InteractiveSSHConnection, enabling tools like EEUpdate that pause mid-output and require user input to complete without hanging.

Interactive command handling:

Added a new interactive_custom_command method to InteractiveSSHConnection that executes commands requiring mid-execution user prompts. Unlike execute_command, which only waits for the shell prompt to return, this method polls the channel in a loop and automatically responds to two interactive patterns:

"Press to continue..." — sends a newline when press_enter=True, allowing paged help output (e.g. eeupdate -h) to scroll through all pages
"Continue (Y or N)?" — sends the provided confirm character (e.g. "y" or "n") when set, enabling destructive commands like -nvm_clear to proceed without hanging
The method returns a ConnectionCompletedProcess with both stdout and raw_output set to the full collected output, and return_code retrieved via the existing _get_return_code mechanism.

Base class declaration:

Added interactive_custom_command to the Connection base class in base.py as a non-abstract method raising NotImplementedError, so connection types that do not implement it (SSH, WinRM, RPyC, etc.) produce a clear, descriptive error instead of a silent AttributeError.

Documentation updates:

README.md — Added interactive_custom_command to the InteractiveSSHConnection Public APIs section, documenting the press_enter and confirm parameters and the return type
CHANGELOG.md — Added an Unreleased entry describing the new feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant