File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -258,12 +258,15 @@ if [[ $WORKINGDIR != '""' ]]; then
258
258
fi
259
259
260
260
# First preference goes to both entrypoint / cmd, then individual
261
- if [ -n " $ENTRYPOINT " ] && [ -n " $CMD " ]; then
262
- echo exec " $ENTRYPOINT " " $CMD " ' "$@"' >> $build_sandbox /.singularity.d/runscript;
261
+ if [ -n " $CMD " ]; then
262
+ echo ' if [ $# = 0 ]; then' >> $build_sandbox /.singularity.d/runscript
263
+ # Only add the entrypoint if it's not null
264
+ echo \ \ exec ${ENTRYPOINT: +" $ENTRYPOINT " } " $CMD " >> $build_sandbox /.singularity.d/runscript;
265
+ echo " else" >> $build_sandbox /.singularity.d/runscript
266
+ echo \ \ exec ${ENTRYPOINT: +" $ENTRYPOINT " } ' "$@"' >> $build_sandbox /.singularity.d/runscript;
267
+ echo " fi" >> $build_sandbox /.singularity.d/runscript
263
268
elif [ -n " $ENTRYPOINT " ]; then
264
269
echo exec " $ENTRYPOINT " ' "$@"' >> $build_sandbox /.singularity.d/runscript;
265
- elif [ -n " $CMD " ]; then
266
- echo exec " $CMD " ' "$@"' >> $build_sandbox /.singularity.d/runscript;
267
270
fi
268
271
269
272
chmod +x $build_sandbox /.singularity.d/runscript;
You can’t perform that action at this time.
0 commit comments