gnodet-bot commented on code in PR #13717:
URL: https://github.com/apache/maven/pull/13717#discussion_r4397838689
##########
apache-maven/src/assembly/maven/bin/mvn.cmd:
##########
@@ -165,10 +166,12 @@ goto javaGate
:tryFastVersion
if defined IS_VERBOSE goto javaGate
if defined IS_MAIN_OVERRIDE goto javaGate
-set "VERSION_SETTINGS_TEMP=%TEMP%\mvn-version-%RANDOM%-%RANDOM%.txt"
+call :mkTempDir version VERSION_SETTINGS_DIR
+if ERRORLEVEL 1 goto javaGate
+set "VERSION_SETTINGS_TEMP=%VERSION_SETTINGS_DIR%\settings.txt"
"%JAVACMD%" --enable-native-access=ALL-UNNAMED -XshowSettings:properties
-version 2> "%VERSION_SETTINGS_TEMP%"
if ERRORLEVEL 1 (
- del "%VERSION_SETTINGS_TEMP%" 2>nul
+ rd /s /q "%VERSION_SETTINGS_DIR%" 2>nul
set "VERSION_SETTINGS_TEMP="
Review Comment:
⚠️ **Nit — stale variable on java failure path**
After `rd /s /q` removes the directory, `VERSION_SETTINGS_DIR` stays defined
(it still holds the now-deleted path). Only `VERSION_SETTINGS_TEMP` is cleared.
For symmetry with the initial `set "VERSION_SETTINGS_DIR="` at the top of the
script, clear it here too.
```suggestion
rd /s /q "%VERSION_SETTINGS_DIR%" 2>nul
set "VERSION_SETTINGS_DIR="
set "VERSION_SETTINGS_TEMP="
```
--
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]