gnodet commented on code in PR #79:
URL: https://github.com/apache/maven-wrapper/pull/79#discussion_r1063543811


##########
maven-wrapper-distribution/src/resources/mvnw:
##########
@@ -193,42 +193,48 @@ else
     else
       
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/@@project.version@@/maven-wrapper-@@project.version@@.jar";
     fi
-    while IFS="=" read key value; do
+    while IFS="=" read -r key value; do
       case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;;
       esac
     done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
     log "Downloading from: $wrapperUrl"
 
     if $cygwin; then
-      wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+      wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
     fi
 
     if command -v wget > /dev/null; then
         log "Found wget ... using wget"
+        wgetrc=0
         [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
         if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
             wget $QUIET "$wrapperUrl" -O "$wrapperJarPath"
+            wgetrc=$?
         else
             wget $QUIET --http-user="$MVNW_USERNAME" 
--http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath"
+            wgetrc=$?
         fi
-        [ $? -eq 0 ] || rm -f "$wrapperJarPath"
+        [ $wgetrc -eq 0 ] || rm -f "$wrapperJarPath"
     elif command -v curl > /dev/null; then
         log "Found curl ... using curl"
+        curlrc=0
         [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
         if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
             curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L
+            curlrc=$?
         else
             curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o 
"$wrapperJarPath" "$wrapperUrl" -f -L
+            curlrc=$?
         fi
-        [ $? -eq 0 ] || rm -f "$wrapperJarPath"
+        [ $curlrc -eq 0 ] || rm -f "$wrapperJarPath"

Review Comment:
   Do I miss something or the shell will exit if curl/wget fail ?
   If so the `rm -f "$wrapperJarPath"` is useless anyway...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to