Skip to content

Commit

Permalink
Prevent shell expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
nkaretnikov committed May 18, 2024
1 parent ad51d60 commit 97610a3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions argo_jupyter_scheduler/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,11 @@ def gen_papermill_command_input(
logger.info(f"html_path: {html_path}")
logger.info(f"papermill_status_path: {papermill_status_path}")

papermill = f"( papermill -k {kernel_name} {input_path} {output_path} ; ec=$(echo $?) ; echo $ec > {papermill_status_path} ; exit $ec )"
papermill = f"( papermill -k {kernel_name} {input_path} {output_path} ; ec=$? ; echo $ec > {papermill_status_path} ; exit $ec )"
jupyter = f"jupyter nbconvert --to html {output_path} --output {html_path}"

return f'conda run -p {conda_env_path} /bin/sh -c "{{ {papermill} && {jupyter} ; }} >> {log_path} 2>&1"'
# It's important that inner quotes are single quotes to prevent shell expansion
return f"conda run -p {conda_env_path} /bin/sh -c '{{ {papermill} && {jupyter} ; }} >> {log_path} 2>&1'"


def sanitize_label(s: str):
Expand Down

0 comments on commit 97610a3

Please sign in to comment.