Skip to content

Commit 217e3ce

Browse files
fix: wrong group.
1 parent f0903ac commit 217e3ce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/common/utils/tool_code.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def exec_code(self, code_str, keywords):
4949
sys.path += {python_paths}
5050
env = dict(os.environ)
5151
for key in list(env.keys()):
52-
if key in os.environ and (key.startswith('MAXKB') or key.startswith('POSTGRES') or key.startswith('PG')):
52+
if key in os.environ and (key.startswith('MAXKB') or key.startswith('POSTGRES') or key.startswith('PG') or key.startswith('REDIS')):
5353
del os.environ[key]
5454
locals_v={'{}'}
5555
keywords={keywords}
@@ -84,7 +84,7 @@ def _exec_sandbox(self, _code, _id):
8484
exec_python_file = f'{self.sandbox_path}/{_id}.py'
8585
with open(exec_python_file, 'w') as file:
8686
file.write(_code)
87-
os.system(f"chown {self.user}:{self.user} {exec_python_file}")
87+
os.system(f"chown {self.user}:root {exec_python_file}")
8888
kwargs = {'cwd': BASE_DIR}
8989
subprocess_result = subprocess.run(
9090
['su', '-s', python_directory, '-c', "exec(open('" + exec_python_file + "').read())", self.user],

0 commit comments

Comments
 (0)