nextflow-io / nextflow-io/nextflow

module support for zsh

Open
#5,980 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Groovy
Stars
3.5k
Forks
811
Avg merge
2d 11h
Merged PRs (30d)
61

Description

New feature

Ability to use the module directive in a process for users who use zsh (and I presume other non-bash shells).

If a user has zsh as their shell, then the module directive fails (with "module command" unknown). Also if the user does a "module load" in their script. This is not Nextflow specific but a consequence of module being an alias rather than a command: if zsh is your shell and you have a bash script

#/bin/bash
module load something

and you run it bash myscript.sh, you get the same problem.

Use case

Would make our workflows much more versatile.

Suggested implementation

I've found two workarounds, which may be a stepping stone to a solution

Solution 1: Run as an interactive shell

In the above example, bash -i myscript.sh works and presumably if .command.run could be run as interactive it would work. But I am not sure of the consequences of this

Solution 2: Use the modulecmd command

This is what I do in my scripts and it seems to work but looks hacky (so I'd prefer it hidden in command.run), which would also be more flexible

script:
  """
  modulecmd bash load gemma > .module_def
  source .module_def

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how Nextflow generates and runs .command.run for process scripts, then compare behavior under zsh and non-interactive bash. Review the suggested interactive-shell and modulecmd approaches, including sourcing the generated module definitions. Done means process module directives work for zsh users without requiring workflow authors to add workarounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
zsh
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.