Skip to content

Commit b968b42

Browse files
committed
use ensure_writable
1 parent c20a7e1 commit b968b42

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Diff for: cwltool/job.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,14 @@ def relink_initialworkdir(
9292
# Thus, none of our business
9393
continue
9494
host_outdir_tgt = os.path.join(host_outdir, vol.target[len(container_outdir) + 1 :])
95-
mode = os.stat(host_outdir_tgt).st_mode | stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH
96-
mode = 0o664 # Doesn't work for my code
97-
mode = 0o777 # works for my code
9895
if os.path.islink(host_outdir_tgt) or os.path.isfile(host_outdir_tgt):
9996
try:
100-
os.chmod(host_outdir_tgt, mode)
97+
ensure_writable(host_outdir_tgt, include_root=True)
10198
os.remove(host_outdir_tgt)
10299
except PermissionError:
103100
pass
104101
elif os.path.isdir(host_outdir_tgt) and not vol.resolved.startswith("_:"):
105-
os.chmod(host_outdir_tgt, mode)
102+
ensure_writable(host_outdir_tgt, include_root=True)
106103
shutil.rmtree(host_outdir_tgt)
107104
if not vol.resolved.startswith("_:"):
108105
try:

0 commit comments

Comments
 (0)