소스 검색

Fix: Avoid bash backtick eval in runtime commands. (#2180)

Signed-off-by: ifuryst <ifuryst@gmail.com>
Leo 1 년 전
부모
커밋
78e003caf6
1개의 변경된 파일4개의 추가작업 그리고 7개의 파일을 삭제
  1. 4 7
      opendevin/runtime/server/runtime.py

+ 4 - 7
opendevin/runtime/server/runtime.py

@@ -49,16 +49,13 @@ class ServerRuntime(Runtime):
 
     async def run_ipython(self, action: IPythonRunCellAction) -> Observation:
         obs = self._run_command(
-            ('cat > /tmp/opendevin_jupyter_temp.py <<EOL\n' f'{action.code}\n' 'EOL'),
+            ("cat > /tmp/opendevin_jupyter_temp.py <<'EOL'\n" f'{action.code}\n' 'EOL'),
             background=False,
         )
 
         # run the code
         obs = self._run_command(
-            (
-                'export JUPYTER_PWD=$(pwd) && cat /tmp/opendevin_jupyter_temp.py | execute_cli'
-            ),
-            background=False,
+            ('cat /tmp/opendevin_jupyter_temp.py | execute_cli'), background=False
         )
         output = obs.content
         if 'pip install' in action.code and 'Successfully installed' in output:
@@ -70,7 +67,7 @@ class ServerRuntime(Runtime):
             ):
                 obs = self._run_command(
                     (
-                        'cat > /tmp/opendevin_jupyter_temp.py <<EOL\n'
+                        "cat > /tmp/opendevin_jupyter_temp.py <<'EOL'\n"
                         f'{restart_kernel}\n'
                         'EOL'
                     ),
@@ -91,7 +88,7 @@ class ServerRuntime(Runtime):
                 if action.kernel_init_code:
                     obs = self._run_command(
                         (
-                            f'cat > /tmp/opendevin_jupyter_init.py <<EOL\n'
+                            f"cat > /tmp/opendevin_jupyter_init.py <<'EOL'\n"
                             f'{action.kernel_init_code}\n'
                             'EOL'
                         ),