-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Prevent binary log files to crash snakemake execution with `show…
…-failed-logs` (#2827) ### Description As described in #2826 currently the whole snakemake execution crashes if a log file is binary and `show-failed-logs` is used. This fix prevents the crash by capturing the `UnicodeDecodeError` and returning an error message that the log file is not a text instead. ### QC * [x] The PR contains a test case for the changes or the changes are already covered by an existing test case. * [x] The documentation (`docs/`) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake). --------- Co-authored-by: Vito Zanotelli <vito.zanotelli@gmail.com>
- Loading branch information
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
rule: | ||
log: | ||
'log.bin' | ||
run: | ||
import pickle | ||
with open(log[0], 'wb') as f: | ||
# Write anything binary to the file | ||
# that cannot be interpreted as unicode | ||
# dumping the log object was an easy way to do this | ||
pickle.dump(log, f) | ||
# make this test fail | ||
a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters