Skip to content

Commit 20e3eab

Browse files
jfennickmr-c
authored andcommitted
use os.chmod and add write to existing mode
1 parent 9508896 commit 20e3eab

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

cwltool/job.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,25 @@ def relink_initialworkdir(
9898
# directory, so therefore ineligable for being an output file.
9999
# Thus, none of our business
100100
continue
101-
host_outdir_tgt = os.path.join(host_outdir, vol.target[len(container_outdir) + 1 :])
101+
host_outdir_tgt = os.path.join(
102+
host_outdir, vol.target[len(container_outdir) + 1 :]
103+
)
104+
mode = (
105+
os.stat(host_outdir_tgt).st_mode
106+
| stat.S_IWUSR
107+
| stat.S_IWGRP
108+
| stat.S_IWOTH
109+
)
102110
if os.path.islink(host_outdir_tgt) or os.path.isfile(host_outdir_tgt):
103-
subprocess.run(["chmod", "777", host_outdir_tgt], check=True)
111+
os.chmod(host_outdir_tgt, mode)
104112
os.remove(host_outdir_tgt)
105113
elif os.path.isdir(host_outdir_tgt) and not vol.resolved.startswith("_:"):
106-
subprocess.run(["chmod", "777", host_outdir_tgt], check=True)
114+
os.chmod(host_outdir_tgt, mode)
107115
shutil.rmtree(host_outdir_tgt)
108116
if not vol.resolved.startswith("_:"):
109117
os.symlink(vol.resolved, host_outdir_tgt)
110118

119+
111120
def neverquote(string: str, pos: int = 0, endpos: int = 0) -> Optional[Match[str]]:
112121
return None
113122

0 commit comments

Comments
 (0)