Skip to content

Commit 42c9874

Browse files
committed
Updates based on PR feedback: #15338 (review). Remove evals and make variables local.
1 parent cb89755 commit 42c9874

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sbin/spark-daemon.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,9 @@ if [ "$SPARK_NICENESS" = "" ]; then
124124
fi
125125

126126
execute_command() {
127-
command="$@"
128-
if [ "$SPARK_NO_DAEMONIZE" != "" ]; then
129-
eval $command
130-
else
131-
eval "nohup $command >> \"$log\" 2>&1 < /dev/null &"
127+
local command="$@"
128+
if [ -z ${SPARK_NO_DAEMONIZE+set} ]; then
129+
nohup -- $command >> $log 2>&1 < /dev/null &
132130
newpid="$!"
133131

134132
echo "$newpid" > "$pid"
@@ -149,6 +147,8 @@ execute_command() {
149147
tail -2 "$log" | sed 's/^/ /'
150148
echo "full log in $log"
151149
fi
150+
else
151+
$command
152152
fi
153153
}
154154

@@ -176,11 +176,11 @@ run_command() {
176176

177177
case "$mode" in
178178
(class)
179-
execute_command "nice -n \"$SPARK_NICENESS\" \"${SPARK_HOME}/bin/spark-class\" $command $@"
179+
execute_command nice -n $SPARK_NICENESS ${SPARK_HOME}/bin/spark-class $command $@
180180
;;
181181

182182
(submit)
183-
execute_command "nice -n \"$SPARK_NICENESS\" \"${SPARK_HOME}/bin/spark-submit\" --class $command $@"
183+
execute_command nice -n $SPARK_NICENESS bash ${SPARK_HOME}/bin/spark-submit --class $command $@
184184
;;
185185

186186
(*)

0 commit comments

Comments
 (0)