Skip to content

Commit

Permalink
switch to the user shell
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartManoj committed Mar 1, 2025
1 parent 3f023d6 commit fab189c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion openhands/runtime/utils/bash_pexpect.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ def __init__(

def initialize(self):
"""Initialize the Bash session using pexpect."""
self.child = pexpect.spawn('/bin/bash', encoding='utf-8', echo=False, timeout=None)
_shell_command = '/bin/bash'
if self.username in ['root', 'openhands']:
# This starts a non-login (new) shell for the given user
_shell_command = f'su {self.username} -'
self.child = pexpect.spawn(_shell_command, encoding='utf-8', echo=False, timeout=None)

logger.info(f'PS1: {self.PS1}')
# Configure bash to use a simple PS1 prompt
Expand Down

0 comments on commit fab189c

Please sign in to comment.