Skip to content

Commit f5352b2

Browse files
authored
Merge pull request #4704 from ESMCI/jgfouca/fix_perm_chmod
If batch script is already executable, don't chmod it
2 parents 450cb5b + 614fa55 commit f5352b2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

CIME/XML/env_batch.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,14 @@ def make_batch_script(self, input_template, job, case, outfile=None):
298298
fd.write(output_text)
299299

300300
# make sure batch script is exectuble
301-
os.chmod(
302-
output_name,
303-
os.stat(output_name).st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH,
304-
)
301+
if not os.access(output_name, os.X_OK):
302+
os.chmod(
303+
output_name,
304+
os.stat(output_name).st_mode
305+
| stat.S_IXUSR
306+
| stat.S_IXGRP
307+
| stat.S_IXOTH,
308+
)
305309

306310
def set_job_defaults(self, batch_jobs, case):
307311
if self._batchtype is None:

0 commit comments

Comments
 (0)