diff --git a/snakemake/dag.py b/snakemake/dag.py index 12f99175d..633e1f4a6 100755 --- a/snakemake/dag.py +++ b/snakemake/dag.py @@ -1308,6 +1308,12 @@ def handle_pipes_and_services(self): "a dead lock.".format(f), rule=job.rule, ) + elif is_pipe and depending[0].is_norun: + raise WorkflowError( + f"Output file {f} is marked as pipe but is requested by a rule that " + "does not execute anything. This is not allowed because it would lead " + "to a dead lock." + ) for dep in depending: if dep.is_run: diff --git a/tests/test_pipe_depend/Snakefile b/tests/test_pipe_depend/Snakefile new file mode 100644 index 000000000..a87a9d4a6 --- /dev/null +++ b/tests/test_pipe_depend/Snakefile @@ -0,0 +1,11 @@ +rule all: + input: + "test.txt" + + +rule a: + output: + pipe("test.txt") + shell: + "echo test > {output}" + diff --git a/tests/test_pipe_depend/expected-results/.gitkeep b/tests/test_pipe_depend/expected-results/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/tests/tests.py b/tests/tests.py index f95c2109e..4783b024d 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -1565,3 +1565,13 @@ def test_service_jobs(): def test_incomplete_params(): run(dpath("test_incomplete_params"), dryrun=True, printshellcmds=True) + + +@skip_on_windows # no pipe support on windows +def test_pipe_depend(): + run(dpath("test_pipe_depend"), shouldfail=True) + + +@skip_on_windows # no pipe support on windows +def test_pipe_depend_target_file(): + run(dpath("test_pipe_depend"), targets=["test.txt"], shouldfail=True)