-
Notifications
You must be signed in to change notification settings - Fork 642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Nextflow compatible with NixOS (or other systems without /bin/bash
)
#5432
base: master
Are you sure you want to change the base?
Changes from all commits
b036e78
29df9b7
94fe6b0
9fdd844
1d9839e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,8 @@ class BashWrapperBuilder { | |
|
||
static final public List<String> BASH | ||
|
||
static final public List<String> ENV_BASH | ||
|
||
static private int level | ||
|
||
@PackageScope | ||
|
@@ -85,6 +87,7 @@ class BashWrapperBuilder { | |
log.warn "Invalid value for `NXF_DEBUG` variable: $str -- See http://www.nextflow.io/docs/latest/config.html#environment-variables" | ||
} | ||
BASH = Collections.unmodifiableList( level > 0 ? ['/bin/bash','-uex'] : ['/bin/bash','-ue'] ) | ||
ENV_BASH = Collections.unmodifiableList(['/usr/bin/env', '-S', 'bash', BASH[1]]) | ||
|
||
} | ||
|
||
|
@@ -571,7 +574,8 @@ class BashWrapperBuilder { | |
final traceWrapper = isTraceRequired() | ||
if( traceWrapper ) { | ||
// executes the stub which in turn executes the target command | ||
launcher = "/bin/bash ${fileStr(wrapperFile)} nxf_trace" | ||
String traceInterpreter = runWithContainer ? "/bin/bash" : "/usr/bin/env bash" | ||
launcher = "${traceInterpreter} ${fileStr(wrapperFile)} nxf_trace" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No |
||
} | ||
else { | ||
launcher = "${interpreter} ${fileStr(scriptFile)}" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,7 +131,7 @@ class LocalTaskHandler extends TaskHandler implements FusionAwareTask { | |
} | ||
|
||
protected ProcessBuilder localProcessBuilder() { | ||
final cmd = new ArrayList<String>(BashWrapperBuilder.BASH) << wrapperFile.getName() | ||
final cmd = new ArrayList<String>(BashWrapperBuilder.ENV_BASH) << wrapperFile.getName() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes sure that |
||
log.debug "Launch cmd line: ${cmd.join(' ')}" | ||
// make sure it's a posix file system | ||
if( task.workDir.fileSystem != FileSystems.default ) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,7 +133,7 @@ class TaskBean implements Serializable, Cloneable { | |
this.condaEnv = task.getCondaEnv() | ||
this.spackEnv = task.getSpackEnv() | ||
this.moduleNames = task.config.getModule() | ||
this.shell = task.config.getShell() ?: BashWrapperBuilder.BASH | ||
this.shell = task.config.getShell(task.isContainerEnabled()) ?: BashWrapperBuilder.BASH | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At this point, |
||
this.script = task.getScript() | ||
this.beforeScript = task.config.getBeforeScript() | ||
this.afterScript = task.config.getAfterScript() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -375,10 +375,10 @@ class TaskConfig extends LazyMap implements Cloneable { | |
return (List<String>) get('secret') | ||
} | ||
|
||
List<String> getShell() { | ||
List<String> getShell(boolean isContainerEnabled = true) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm happy to adapt the unit tests but I don't know how 🤷 . |
||
final value = get('shell') | ||
if( !value ) | ||
return BashWrapperBuilder.BASH | ||
return isContainerEnabled ? BashWrapperBuilder.BASH : BashWrapperBuilder.ENV_BASH | ||
|
||
if( value instanceof List ) | ||
return (List)value | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to rename
BASH
toBIN_BASH
to make the difference clear.