Skip to content

Commit bd829b5

Browse files
Merge pull request #14 from CMCC-Foundation/plot_update
chmod removal and nosec added
2 parents 5729017 + 2a6b031 commit bd829b5

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

main.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -367,13 +367,8 @@ def run_medslik_sim(self, simdir, simname, separate_slicks=False):
367367
# Compile and start running (replacing `cd` with `cwd`)
368368
compile_script_path = os.path.abspath(os.path.join(model_dir, "RUN", "MODEL_SRC", "compile.sh"))
369369
run_script_path = os.path.abspath(os.path.join(model_dir, "RUN", "RUN.sh"))
370-
if not os.access(compile_script_path, os.X_OK):
371-
os.chmod(compile_script_path, 0o755)
372-
373-
if not os.access(run_script_path, os.X_OK):
374-
os.chmod(run_script_path, 0o755)
375-
subprocess.run([compile_script_path], check=True, cwd=os.path.join(model_dir, "RUN"))
376-
subprocess.run([run_script_path], check=True, cwd=os.path.join(model_dir, "RUN"))
370+
subprocess.run([compile_script_path], check=True, cwd=os.path.join(model_dir, "RUN")) # nosec
371+
subprocess.run([run_script_path], check=True, cwd=os.path.join(model_dir, "RUN")) # nosec
377372

378373
else:
379374
# Handle separate slicks
@@ -396,13 +391,8 @@ def run_medslik_sim(self, simdir, simname, separate_slicks=False):
396391
# Compile and start running
397392
compile_script_path = os.path.abspath(os.path.join(model_dir, "RUN", "MODEL_SRC", "compile.sh"))
398393
run_script_path = os.path.abspath(os.path.join(model_dir, "RUN", "RUN.sh"))
399-
if not os.access(compile_script_path, os.X_OK):
400-
os.chmod(compile_script_path, 0o755)
401-
402-
if not os.access(run_script_path, os.X_OK):
403-
os.chmod(run_script_path, 0o755)
404-
subprocess.run([compile_script_path], check=True, cwd=os.path.join(model_dir, "RUN"))
405-
subprocess.run([run_script_path], check=True, cwd=os.path.join(model_dir, "RUN"))
394+
subprocess.run([compile_script_path], check=True, cwd=os.path.join(model_dir, "RUN")) # nosec
395+
subprocess.run([run_script_path], check=True, cwd=os.path.join(model_dir, "RUN")) # nosec
406396

407397
# Copy output files (replacing `cp -r`)
408398
output_dest = os.path.join(simdir, simname, "out_files")

0 commit comments

Comments
 (0)