Skip to content

Commit c2c23d6

Browse files
committed
use os.chmod and add write to existing mode
1 parent e3efe52 commit c2c23d6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cwltool/job.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,22 @@ def relink_initialworkdir(
9494
host_outdir_tgt = os.path.join(
9595
host_outdir, vol.target[len(container_outdir) + 1 :]
9696
)
97+
mode = (
98+
os.stat(host_outdir_tgt).st_mode
99+
| stat.S_IWUSR
100+
| stat.S_IWGRP
101+
| stat.S_IWOTH
102+
)
97103
if os.path.islink(host_outdir_tgt) or os.path.isfile(host_outdir_tgt):
98-
subprocess.run(["chmod", "777", host_outdir_tgt], check=True)
104+
os.chmod(host_outdir_tgt, mode)
99105
os.remove(host_outdir_tgt)
100106
elif os.path.isdir(host_outdir_tgt) and not vol.resolved.startswith("_:"):
101-
subprocess.run(["chmod", "777", host_outdir_tgt], check=True)
107+
os.chmod(host_outdir_tgt, mode)
102108
shutil.rmtree(host_outdir_tgt)
103109
if not vol.resolved.startswith("_:"):
104110
os.symlink(vol.resolved, host_outdir_tgt)
105111

112+
106113
def neverquote(string: str, pos: int = 0, endpos: int = 0) -> Optional[Match[str]]:
107114
return None
108115

0 commit comments

Comments
 (0)