Skip to content

Commit

Permalink
Add more details about the pipefail option
Browse files Browse the repository at this point in the history
Link to docs on bash's strict mode and provide examples of how
Snakemake's default use of this mode might be overridden in a workflow.
  • Loading branch information
huddlej committed Nov 15, 2023
1 parent f1bf402 commit 1664eec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/reference/snakemake-style-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ Example:
--output-metadata {output.metadata} 2>&1 | tee {log}
"""
Before using ``tee``, ensure that your workflow uses bash's ``pipefail`` option, so successful ``tee`` execution does not mask errors from earlier commands in the pipe.
Snakemake enables this option by default.
Before using ``tee``, ensure that your workflow uses `bash's pipefail option <http://redsymbol.net/articles/unofficial-bash-strict-mode/>`_, so successful ``tee`` execution does not mask errors from earlier commands in the pipe.
Snakemake uses bash's strict mode by default, so the pipefail option should be enabled by default.
However, some workflows may override the defaults `locally at specific rules <https://snakemake.readthedocs.io/en/stable/project_info/faq.html#my-shell-command-fails-with-exit-code-0-from-within-a-pipe-what-s-wrong>`_ or globally as with `a custom shell prefix <https://github.com/nextstrain/ncov/pull/751>`_.

Run workflows with ``--show-failed-logs``
=========================================
Expand Down

0 comments on commit 1664eec

Please sign in to comment.