Skip to content

Commit

Permalink
added to sudo group
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartManoj committed Apr 14, 2024
1 parent 53f9505 commit 18397fc
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions opendevin/sandbox/exec_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,17 @@ def __init__(
atexit.register(self.close)

def setup_devin_user(self):
exit_code, logs = self.container.exec_run(
[
'/bin/bash',
'-c',
f'useradd --shell /bin/bash -u {USER_ID} -o -c "" -m devin',
],
workdir='/workspace',
)
cmds = [
f'useradd --shell /bin/bash -u {USER_ID} -o -c "" -m devin',
r"echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers",
'sudo adduser devin sudo',
]
for cmd in cmds:
exit_code, logs = self.container.exec_run(
['/bin/bash', '-c', cmd], workdir='/workspace'
)
if exit_code != 0:
raise Exception(f'Failed to setup devin user: {logs}')

def get_exec_cmd(self, cmd: str) -> List[str]:
if RUN_AS_DEVIN:
Expand Down Expand Up @@ -271,7 +274,7 @@ def close(self):
"Interactive Docker container started. Type 'exit' or use Ctrl+C to exit.")

bg_cmd = exec_box.execute_in_background(
"while true; do echo 'dot ' && sleep 1; done"
"while true; do echo -n '.' && sleep 1; done"
)

sys.stdout.flush()
Expand Down

0 comments on commit 18397fc

Please sign in to comment.