Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cwltool/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ def get_image(
found = True
elif "dockerFile" in docker_requirement:
dockerfile_dir = create_tmp_dir(tmp_outdir_prefix)
with open(os.path.join(dockerfile_dir, "Dockerfile"), "wb") as dfile:
dfile.write(docker_requirement["dockerFile"].encode("utf-8"))
with open(os.path.join(dockerfile_dir, "Dockerfile"), "w") as dfile:
dfile.write(docker_requirement["dockerFile"])
cmd = [
"docker",
"build",
Expand Down
10 changes: 5 additions & 5 deletions cwltool/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,8 @@ def create_file_and_add_volume(
dirname = os.path.dirname(host_outdir_tgt or new_file)
if not os.path.exists(dirname):
os.makedirs(dirname)
with open(host_outdir_tgt or new_file, "wb") as file_literal:
file_literal.write(contents.encode("utf-8"))
with open(host_outdir_tgt or new_file, "w") as file_literal:
file_literal.write(contents)
if not host_outdir_tgt:
self.append_volume(runtime, new_file, volume.target, writable=writable)
if writable:
Expand Down Expand Up @@ -1031,8 +1031,8 @@ def terminate(): # type: () -> None
) as job_file:
json_dump(job_description, job_file, ensure_ascii=False)
job_script = os.path.join(job_dir, "run_job.bash")
with open(job_script, "wb") as _:
_.write(job_script_contents.encode("utf-8"))
with open(job_script, "w") as _:
_.write(job_script_contents)

job_run = os.path.join(job_dir, "run_job.py")
shutil.copyfile(run_job.__file__, job_run)
Expand All @@ -1041,7 +1041,7 @@ def terminate(): # type: () -> None
shutil.copyfile(env_to_stdout.__file__, env_getter)

sproc = subprocess.Popen( # nosec
["bash", job_script.encode("utf-8")],
["bash", job_script],
shell=False, # nosec
cwd=job_dir,
# The nested script will output the paths to the correct files if they need
Expand Down
8 changes: 3 additions & 5 deletions cwltool/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,11 @@ def stage_files(
shutil.copytree(entry.resolved, entry.target)
ensure_writable(entry.target, include_root=True)
elif entry.type == "CreateFile" or entry.type == "CreateWritableFile":
with open(entry.target, "wb") as new:
with open(entry.target, "w") as new:
if secret_store is not None:
new.write(
cast(str, secret_store.retrieve(entry.resolved)).encode("utf-8")
)
new.write(cast(str, secret_store.retrieve(entry.resolved)))
else:
new.write(entry.resolved.encode("utf-8"))
new.write(entry.resolved)
if entry.type == "CreateFile":
os.chmod(entry.target, stat.S_IRUSR) # Read only
else: # it is a "CreateWritableFile"
Expand Down