Repository navigation
fix: write .command.sh flush-left so <<- heredocs match (#43) - #44
Merged
Merged
Conversation
nf-spawn embedded task.script into the staging heredoc with its source indentation preserved. nf-core modules indent their script body and emit versions.yml via a `<<-END_VERSIONS` heredoc whose terminator sits at that same indentation. `<<-` strips leading TABS only, not spaces — so the space-indented terminator never matched, the heredoc swallowed it, and versions.yml came out malformed, aborting the whole session with a SnakeYAML `while scanning a simple key` error. dedentTaskScript() now strips the longest common leading-whitespace prefix (ignoring blank lines, preserving relative indentation) before embedding, the way Nextflow writes .command.sh itself, so heredoc terminators land at column 0.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #43.
Great progress upstream: #41 fixed staging, FASTQC ran, and one taxprofiler sample went all the way through. But the session still aborted on a malformed
versions.yml:Root cause
nf-core modules indent their process script and emit
versions.ymlvia a<<-END_VERSIONSheredoc whose terminator sits at the same indentation. The<<-operator strips leading tabs only, never spaces. Nextflow normally writes.command.shflush-left (common leading whitespace stripped), so the terminator ends up at column 0 and matches.nf-spawn embedded
task.scriptinto itscat > .command.sh <<'NF_SPAWN_TASK_EOF'staging heredoc with the source indentation preserved. So the space-indentedEND_VERSIONSnever matched the bare delimiter, the heredoc swallowed its own terminator (and everything after), andversions.ymlcame out malformed → SnakeYAML aborts the whole session. Affects essentially every nf-core module.Fix
New
dedentTaskScript()strips the longest common leading-whitespace prefix shared by all non-blank lines (blank lines ignored; relative indentation within the script preserved) before embedding — matching Groovy'sstripIndent/Nextflow's behavior. Heredoc terminators now land at column 0 and<<-works.Tests
38 total, 0 failures. Added:
dedentTaskScriptstrips common indent / preserves relative indent / leaves flush-left & empty/null alone; and an end-to-end assertion thatbuildStagingScriptemits the terminator at column 0 (\nEND_VERSIONS\nNF_SPAWN_TASK_EOF, noEND_VERSIONS).Built + tested on JDK 17 / Nextflow 26.04.x.