Skip to content

Commit

Permalink
🎨 better error handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Wytamma committed Nov 9, 2023
1 parent aebfe42 commit 4d7fdcc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion snk/cli/subcommands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,11 @@ def _save_dag(self, snakemake_args: List[str], filename: Path):
except SystemExit: # Catch SystemExit exception to prevent termination
pass
try:
snakemake_output = snakemake_output.getvalue()
if "snakemake_dag" not in snakemake_output:
self.error("Could not generate dag!", exit=True)
# discard everything before digraph snakemake_dag
filtered_lines = "digraph snakemake_dag" + snakemake_output.getvalue().split("snakemake_dag")[1]
filtered_lines = "digraph snakemake_dag" + snakemake_output.split("snakemake_dag")[1]
echo_process = subprocess.Popen(
["echo", filtered_lines], stdout=subprocess.PIPE
)
Expand Down

0 comments on commit 4d7fdcc

Please sign in to comment.