remove deprecated wmic command and use systeminfo (#2428)

This commit is contained in:
Thad Guidry 2020-03-24 02:21:43 -05:00 committed by GitHub
parent e484625adf
commit 50d6c02f57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,15 +144,6 @@ set REFINE_MIN_MEMORY=256M
:gotMemory :gotMemory
set OPTS=%OPTS% -Xms%REFINE_MIN_MEMORY% -Xmx%REFINE_MEMORY% -Drefine.memory=%REFINE_MEMORY% set OPTS=%OPTS% -Xms%REFINE_MIN_MEMORY% -Xmx%REFINE_MEMORY% -Drefine.memory=%REFINE_MEMORY%
rem --- Check free memory ---------------------------------------------
for /f "usebackq skip=1 tokens=*" %%i in (`wmic os get FreePhysicalMemory ^| findstr /r /v "^$"`) do @set /A freeRam=%%i/1024
echo You have %freeRam%M of free memory.
echo Your current configuration is set to use %REFINE_MEMORY% of memory.
echo OpenRefine can run better when given more memory. Read our FAQ on how to allocate more memory here:
echo https://github.com/OpenRefine/OpenRefine/wiki/FAQ:-Allocate-More-Memory
echo.
if not "%REFINE_MAX_FORM_CONTENT_SIZE%" == "" goto gotMaxFormContentSize if not "%REFINE_MAX_FORM_CONTENT_SIZE%" == "" goto gotMaxFormContentSize
set REFINE_MAX_FORM_CONTENT_SIZE=1048576 set REFINE_MAX_FORM_CONTENT_SIZE=1048576
:gotMaxFormContentSize :gotMaxFormContentSize
@ -212,14 +203,14 @@ java -version 2^>^&1
echo.===================================================== echo.=====================================================
for /f "tokens=*" %%a in ('java -version 2^>^&1 ^| find "version"') do (set JVERSION=%%a) for /f "tokens=*" %%a in ('java -version 2^>^&1 ^| find "version"') do (set JVERSION=%%a)
echo Getting Free Ram... echo Getting Free Ram...
wmic os get FreePhysicalMemory
for /f "usebackq skip=1 tokens=*" %%i in (`wmic os get FreePhysicalMemory ^| findstr /r /v "^$"`) do @set /A freeRam=%%i/1024 for /f "tokens=2 delims=:" %%i in ('systeminfo ^| findstr /C:"Available Physical Memory"') do (set freeRam=%%i)
( (
echo ----------------------- echo -----------------------
echo PROCESSOR_ARCHITECTURE = %PROCESSOR_ARCHITECTURE% echo PROCESSOR_ARCHITECTURE = %PROCESSOR_ARCHITECTURE%
echo JAVA_HOME = %JAVA_HOME% echo JAVA_HOME = %JAVA_HOME%
echo java -version = %JVERSION% echo java -version = %JVERSION%
echo freeRam = %freeRam%M echo freeRam = %freeRam%
echo REFINE_MEMORY = %REFINE_MEMORY% echo REFINE_MEMORY = %REFINE_MEMORY%
echo ----------------------- echo -----------------------
) > support.log ) > support.log