Skip to content

Commit f5a7412

Browse files
jfennickmr-c
authored andcommitted
use ensure_writable
1 parent 806d695 commit f5a7412

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

cwltool/job.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,14 @@ def relink_initialworkdir(
9999
# Thus, none of our business
100100
continue
101101
host_outdir_tgt = os.path.join(host_outdir, vol.target[len(container_outdir) + 1 :])
102-
mode = os.stat(host_outdir_tgt).st_mode | stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH
103-
mode = 0o664 # Doesn't work for my code
104-
mode = 0o777 # works for my code
105102
if os.path.islink(host_outdir_tgt) or os.path.isfile(host_outdir_tgt):
106103
try:
107-
os.chmod(host_outdir_tgt, mode)
104+
ensure_writable(host_outdir_tgt, include_root=True)
108105
os.remove(host_outdir_tgt)
109106
except PermissionError:
110107
pass
111108
elif os.path.isdir(host_outdir_tgt) and not vol.resolved.startswith("_:"):
112-
os.chmod(host_outdir_tgt, mode)
109+
ensure_writable(host_outdir_tgt, include_root=True)
113110
shutil.rmtree(host_outdir_tgt)
114111
if not vol.resolved.startswith("_:"):
115112
try:

0 commit comments

Comments
 (0)