Github user nchammas commented on a diff in the pull request:
https://github.com/apache/spark/pull/3377#discussion_r22264729
--- Diff: bin/run-example ---
@@ -35,17 +35,29 @@ else
fi
if [ -f "$FWDIR/RELEASE" ]; then
- export SPARK_EXAMPLES_JAR="`ls "$FWDIR"/lib/spark-examples-*hadoop*.jar`"
-elif [ -e
"$EXAMPLES_DIR"/target/scala-$SPARK_SCALA_VERSION/spark-examples-*hadoop*.jar
]; then
- export SPARK_EXAMPLES_JAR="`ls
"$EXAMPLES_DIR"/target/scala-$SPARK_SCALA_VERSION/spark-examples-*hadoop*.jar`"
+ JAR_PATH="${FWDIR}/lib"
+else
+ JAR_PATH="${EXAMPLES_DIR}/target/scala-${SPARK_SCALA_VERSION}"
fi
-if [[ -z "$SPARK_EXAMPLES_JAR" ]]; then
+JAR_COUNT="`ls ${JAR_PATH}/spark-examples-*hadoop*.jar 2>>/dev/null | wc
-l`"
+
+if [ "$JAR_COUNT" -eq "0" ]; then
echo "Failed to find Spark examples assembly in $FWDIR/lib or
$FWDIR/examples/target" 1>&2
echo "You need to build Spark before running this program" 1>&2
exit 1
fi
+if [ "$JAR_COUNT" -gt "1" ]; then
+ JARS_LIST="`ls -t ${JAR_PATH}/spark-examples-*hadoop*.jar`"
+ echo "Found multiple Spark examples assembly jars in ${JAR_PATH}" 1>&2
+ echo "$JARS_LIST" 1>&2
--- End diff --
If we just want to show the user a list of the found jars, why not just
call `ls` directly instead of capturing and replaying its output? That would be
safer and simpler, no?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]