Skip to content

Commit fe5bea9

Browse files
authored
Fix errors when NXF_HOME contains spaces (#4456) [ci fast]
Signed-off-by: Ben Sherman <[email protected]>
1 parent 91c1ab1 commit fe5bea9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nextflow

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ else
320320
if [[ ! $JAVA_VER =~ ^(11|12|13|14|15|16|17|18|19|20|21) ]]; then
321321
echo_yellow "NOTE: Nextflow is not tested with Java $JAVA_VER -- It's recommended the use of version 11 up to 21\n"
322322
fi
323-
mkdir -p $(dirname "$JAVA_KEY")
323+
mkdir -p "$(dirname "$JAVA_KEY")"
324324
[[ -f $JAVA_VER ]] && echo $JAVA_VER > "$JAVA_KEY"
325325
fi
326326

@@ -404,8 +404,8 @@ else
404404
# we extract first part into `cmd_base`` and remainder into `cmd_tail`` and convert them to array as previous version
405405
cmd_pattern='"([^"]*)"(.*)'
406406
[[ "${cli[@]}" =~ $cmd_pattern ]]
407-
cmd_base=(${BASH_REMATCH[1]})
408-
cmd_tail=(${BASH_REMATCH[2]})
407+
declare -a cmd_base="(${BASH_REMATCH[1]})"
408+
declare -a cmd_tail="(${BASH_REMATCH[2]})"
409409

410410
launcher="${cmd_base[@]}"
411411
[[ "$NXF_JVM_ARGS" ]] && launcher+=($NXF_JVM_ARGS)
@@ -443,7 +443,7 @@ else
443443
if mkdir -p "${NXF_LAUNCHER}" 2>/dev/null; then
444444
STR=''
445445
for x in "${launcher[@]}"; do
446-
[[ "$x" != "\"-Duser.dir=$PWD\"" ]] && [[ ! "$x" == *"-agentlib:jdwp"* ]] && STR+="$x "
446+
[[ "$x" != "\"-Duser.dir=$PWD\"" ]] && [[ ! "$x" == *"-agentlib:jdwp"* ]] && STR+=$(printf '%q ' "$x")
447447
done
448448
printf "$STR">"$LAUNCH_FILE"
449449
else

0 commit comments

Comments
 (0)