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
258258fi
259259
260260# 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
263268elif [ -n " $ENTRYPOINT " ]; then
264269 echo exec " $ENTRYPOINT " ' "$@"' >> $build_sandbox /.singularity.d/runscript;
265- elif [ -n " $CMD " ]; then
266- echo exec " $CMD " ' "$@"' >> $build_sandbox /.singularity.d/runscript;
267270fi
268271
269272chmod +x $build_sandbox /.singularity.d/runscript;
You can’t perform that action at this time.
0 commit comments