Skip to content

Commit 45c1985

Browse files
committed
shell security problem
1 parent 709ef23 commit 45c1985

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

ceasiompy/CPACS2GMSH/func/RANS_mesh_generator.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -318,18 +318,17 @@ def pentagrow_3d_mesh(
318318
current_dir = os.getcwd()
319319
os.chdir(current_dir)
320320

321-
command = "pentagrow mesh_2d.stl config.cfg"
322-
321+
# command = "pentagrow mesh_2d.stl config.cfg"
322+
command = ["pentagrow", "mesh_2d.stl", "config.cfg"]
323323
# Specify the file path
324-
file_path = "command.txt" # You can change the file path as needed
324+
file_path = "command.txt"
325325

326-
# Write the command to the file
327-
with open(file_path, "w") as file:
328-
file.write(command)
326+
command_str = " ".join(command)
329327

330-
# log.info(f"Command written to: {file_path}")
328+
with open(file_path, "w") as file:
329+
file.write(command_str)
331330

332-
subprocess.call(command, shell=True, cwd=current_dir, start_new_session=False)
331+
subprocess.call(command, cwd=current_dir, start_new_session=False)
333332

334333
mesh_path = Path(result_dir, "hybrid.su2")
335334
log.info(f"Mesh path:{mesh_path}")

0 commit comments

Comments
 (0)