Skip to content

Commit

Permalink
Merge pull request #4704 from ESMCI/jgfouca/fix_perm_chmod
Browse files Browse the repository at this point in the history
If batch script is already executable, don't chmod it
  • Loading branch information
jgfouca authored Nov 1, 2024
2 parents 450cb5b + 614fa55 commit f5352b2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions CIME/XML/env_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,14 @@ def make_batch_script(self, input_template, job, case, outfile=None):
fd.write(output_text)

# make sure batch script is exectuble
os.chmod(
output_name,
os.stat(output_name).st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH,
)
if not os.access(output_name, os.X_OK):
os.chmod(
output_name,
os.stat(output_name).st_mode
| stat.S_IXUSR
| stat.S_IXGRP
| stat.S_IXOTH,
)

def set_job_defaults(self, batch_jobs, case):
if self._batchtype is None:
Expand Down

0 comments on commit f5352b2

Please sign in to comment.