Skip to content

Commit 78e003c

Browse files
authored
Fix: Avoid bash backtick eval in runtime commands. (#2180)
Signed-off-by: ifuryst <[email protected]>
1 parent be251b1 commit 78e003c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

opendevin/runtime/server/runtime.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,13 @@ async def kill(self, action: CmdKillAction) -> Observation:
4949

5050
async def run_ipython(self, action: IPythonRunCellAction) -> Observation:
5151
obs = self._run_command(
52-
('cat > /tmp/opendevin_jupyter_temp.py <<EOL\n' f'{action.code}\n' 'EOL'),
52+
("cat > /tmp/opendevin_jupyter_temp.py <<'EOL'\n" f'{action.code}\n' 'EOL'),
5353
background=False,
5454
)
5555

5656
# run the code
5757
obs = self._run_command(
58-
(
59-
'export JUPYTER_PWD=$(pwd) && cat /tmp/opendevin_jupyter_temp.py | execute_cli'
60-
),
61-
background=False,
58+
('cat /tmp/opendevin_jupyter_temp.py | execute_cli'), background=False
6259
)
6360
output = obs.content
6461
if 'pip install' in action.code and 'Successfully installed' in output:
@@ -70,7 +67,7 @@ async def run_ipython(self, action: IPythonRunCellAction) -> Observation:
7067
):
7168
obs = self._run_command(
7269
(
73-
'cat > /tmp/opendevin_jupyter_temp.py <<EOL\n'
70+
"cat > /tmp/opendevin_jupyter_temp.py <<'EOL'\n"
7471
f'{restart_kernel}\n'
7572
'EOL'
7673
),
@@ -91,7 +88,7 @@ async def run_ipython(self, action: IPythonRunCellAction) -> Observation:
9188
if action.kernel_init_code:
9289
obs = self._run_command(
9390
(
94-
f'cat > /tmp/opendevin_jupyter_init.py <<EOL\n'
91+
f"cat > /tmp/opendevin_jupyter_init.py <<'EOL'\n"
9592
f'{action.kernel_init_code}\n'
9693
'EOL'
9794
),

0 commit comments

Comments
 (0)