Skip to content

Commit 1c24e9c

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

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
@@ -91,16 +91,25 @@ def relink_initialworkdir(
9191
# directory, so therefore ineligable for being an output file.
9292
# Thus, none of our business
9393
continue
94-
host_outdir_tgt = os.path.join(host_outdir, vol.target[len(container_outdir) + 1 :])
94+
host_outdir_tgt = os.path.join(
95+
host_outdir, vol.target[len(container_outdir) + 1 :]
96+
)
97+
mode = (
98+
os.stat(host_outdir_tgt).st_mode
99+
| stat.S_IWUSR
100+
| stat.S_IWGRP
101+
| stat.S_IWOTH
102+
)
95103
if os.path.islink(host_outdir_tgt) or os.path.isfile(host_outdir_tgt):
96-
subprocess.run(["chmod", "777", host_outdir_tgt], check=True)
104+
os.chmod(host_outdir_tgt, mode)
97105
os.remove(host_outdir_tgt)
98106
elif os.path.isdir(host_outdir_tgt) and not vol.resolved.startswith("_:"):
99-
subprocess.run(["chmod", "777", host_outdir_tgt], check=True)
107+
os.chmod(host_outdir_tgt, mode)
100108
shutil.rmtree(host_outdir_tgt)
101109
if not vol.resolved.startswith("_:"):
102110
os.symlink(vol.resolved, host_outdir_tgt)
103111

112+
104113
def neverquote(string: str, pos: int = 0, endpos: int = 0) -> Optional[Match[str]]:
105114
return None
106115

0 commit comments

Comments
 (0)