Skip to content

Commit bf12f03

Browse files
jfennickmr-c
authored andcommitted
use ensure_writable
1 parent b468cbb commit bf12f03

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

cwltool/job.py

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

0 commit comments

Comments
 (0)