From 10df5608b6938af8c5f0363ddc515ad7e57a4454 Mon Sep 17 00:00:00 2001 From: Igor Trujnara Date: Wed, 8 Jan 2025 14:39:29 +0100 Subject: [PATCH] Add name safety, add compression to stub --- modules/nf-core/ripgrep/main.nf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/nf-core/ripgrep/main.nf b/modules/nf-core/ripgrep/main.nf index 0c8eb16f70e..c283072ed9d 100644 --- a/modules/nf-core/ripgrep/main.nf +++ b/modules/nf-core/ripgrep/main.nf @@ -23,6 +23,9 @@ process RIPGREP { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def write_output = compress ? " | pigz -cp ${task.cpus} > ${prefix}.txt.gz" : "> ${prefix}.txt" + if (!compress && files.contains("${prefix}.txt") || compress && files.contains("${prefix}.txt.gz")) { + error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + } """ rg \\ $args \\ @@ -40,8 +43,9 @@ process RIPGREP { stub: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def write_output = compress ? "touch ${prefix}.txt.gz" : "touch ${prefix}.txt" """ - touch ${prefix}.txt + $write_output cat <<-END_VERSIONS > versions.yml "${task.process}":