From 217e3ce58d39b2ae9ffeca199a6e236a9393ea3b Mon Sep 17 00:00:00 2001 From: liqiang-fit2cloud Date: Wed, 9 Jul 2025 11:43:38 +0800 Subject: [PATCH] fix: wrong group. --- apps/common/utils/tool_code.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/common/utils/tool_code.py b/apps/common/utils/tool_code.py index 9be858c63..ddb888c59 100644 --- a/apps/common/utils/tool_code.py +++ b/apps/common/utils/tool_code.py @@ -49,7 +49,7 @@ try: sys.path += {python_paths} env = dict(os.environ) for key in list(env.keys()): - if key in os.environ and (key.startswith('MAXKB') or key.startswith('POSTGRES') or key.startswith('PG')): + if key in os.environ and (key.startswith('MAXKB') or key.startswith('POSTGRES') or key.startswith('PG') or key.startswith('REDIS')): del os.environ[key] locals_v={'{}'} keywords={keywords} @@ -84,7 +84,7 @@ except Exception as e: exec_python_file = f'{self.sandbox_path}/{_id}.py' with open(exec_python_file, 'w') as file: file.write(_code) - os.system(f"chown {self.user}:{self.user} {exec_python_file}") + os.system(f"chown {self.user}:root {exec_python_file}") kwargs = {'cwd': BASE_DIR} subprocess_result = subprocess.run( ['su', '-s', python_directory, '-c', "exec(open('" + exec_python_file + "').read())", self.user],