Skip to content

Commit 437b602

Browse files
committed
use os.chmod and add write to existing mode
1 parent 03823a3 commit 437b602

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

cwltool/job.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,25 @@ def relink_initialworkdir(
9393
# directory, so therefore ineligable for being an output file.
9494
# Thus, none of our business
9595
continue
96-
host_outdir_tgt = os.path.join(host_outdir, vol.target[len(container_outdir) + 1 :])
96+
host_outdir_tgt = os.path.join(
97+
host_outdir, vol.target[len(container_outdir) + 1 :]
98+
)
99+
mode = (
100+
os.stat(host_outdir_tgt).st_mode
101+
| stat.S_IWUSR
102+
| stat.S_IWGRP
103+
| stat.S_IWOTH
104+
)
97105
if os.path.islink(host_outdir_tgt) or os.path.isfile(host_outdir_tgt):
98-
subprocess.run(["chmod", "777", host_outdir_tgt], check=True)
106+
os.chmod(host_outdir_tgt, mode)
99107
os.remove(host_outdir_tgt)
100108
elif os.path.isdir(host_outdir_tgt) and not vol.resolved.startswith("_:"):
101-
subprocess.run(["chmod", "777", host_outdir_tgt], check=True)
109+
os.chmod(host_outdir_tgt, mode)
102110
shutil.rmtree(host_outdir_tgt)
103111
if not vol.resolved.startswith("_:"):
104112
os.symlink(vol.resolved, host_outdir_tgt)
105113

114+
106115
def neverquote(string: str, pos: int = 0, endpos: int = 0) -> Optional[Match[str]]:
107116
return None
108117

0 commit comments

Comments
 (0)