OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Add support for interactive command input

Open iamEvanYT opened this issue 2 months ago • 3 comments

This PR adds support for interactive command input in the bash execution system.

Changes

  • Add input_text field to CmdRunAction for sending input to interactive processes
  • Enhance bash execution to handle interactive input with clear prompts
  • Update function description to clearly explain interactive command usage
  • Add test case for interactive command handling

Example Usage

# First command - starts interactive process
action = CmdRunAction(
    command="./script.sh",
    blocking=False
)
result = session.run(action)

# If waiting for input (exit_code == -1)
if result.exit_code == -1:
    # Send input
    action = CmdRunAction(
        command="",  # Empty command to continue
        input_text="user input here"
    )
    result = session.run(action)

iamEvanYT avatar Dec 11 '24 22:12 iamEvanYT