smengcl commented on code in PR #12086:
URL: https://github.com/apache/ozone/pull/12086#discussion_r4631464050


##########
hadoop-ozone/dev-support/checks/_lib.sh:
##########
@@ -99,5 +99,13 @@ create_aws_dir() {
 get_version() {
   local dep="$1"
   shift
-  MVNW_VERBOSE=false ./mvnw --non-recursive --quiet help:evaluate 
-Dexpression="${dep}.version" -DforceStdout -Dscan=false "$@"
+
+  local tempfile=$(mktemp)
+
+  # output version/transfer etc. to stderr first
+  ./mvnw --batch-mode --non-recursive --show-version \
+      help:evaluate -Dexpression="${dep}.version" -Doutput="${tempfile}" \
+      -Dscan=false "$@" >&2 \
+    && cat "${tempfile}" \
+    && rm -f "${tempfile}"

Review Comment:
   nit: when Maven fails (for example on a download error, which is what this 
change is chasing), the `&&` chain skips `rm`, so the temp file is left behind.
   
   It is harmless on CI runners, but it accumulates for local runs. Maybe 
remove it unconditionally, and keep the exit code:
   
   ```bash
     local rc=0
     ./mvnw ... >&2 && cat "${tempfile}" || rc=$?
     rm -f "${tempfile}"
     return ${rc}
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to