Skip to content

Commit 95ae378

Browse files
committed
Fix Windows CMD quoting: pass license key/email as separate env vars
- customize.py no longer builds MLC_GEEKBENCH_UNLOCK_CMD string - run.sh constructs unlock command from individual env vars - Both scripts check MLC_GEEKBENCH_LICENSE_KEY directly
1 parent 27dee76 commit 95ae378

3 files changed

Lines changed: 29 additions & 24 deletions

File tree

script/benchmark-program-geekbench/customize.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,18 @@ def preprocess(i):
1717

1818
q = '"' if os_info['platform'] == 'windows' else "'"
1919

20-
# License registration (geekbench6 --unlock <email> <key>)
20+
# License registration
2121
license_key = env.get('MLC_GEEKBENCH_LICENSE_KEY', '').strip()
2222
license_email = env.get('MLC_GEEKBENCH_LICENSE_EMAIL', '').strip()
2323
if license_key:
2424
if not license_email:
2525
return {'return': 1,
2626
'error': 'MLC_GEEKBENCH_LICENSE_EMAIL is required when MLC_GEEKBENCH_LICENSE_KEY is provided'}
27-
unlock_cmd = f"{q}{geekbench_bin}{q} --unlock {license_email} {license_key}"
28-
env['MLC_GEEKBENCH_UNLOCK_CMD'] = unlock_cmd
29-
logger.info(f"Geekbench unlock command prepared: {unlock_cmd}")
27+
# Pass parts separately so shell scripts can construct the command
28+
# without quoting issues
29+
env['MLC_GEEKBENCH_LICENSE_KEY'] = license_key
30+
env['MLC_GEEKBENCH_LICENSE_EMAIL'] = license_email
31+
logger.info("Geekbench license key provided, will register before benchmark")
3032

3133
# Build the run command
3234
args = []

script/benchmark-program-geekbench/run.bat

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ if "%MLC_RUN_DIR%" == "" (
1010

1111
cd /d "%MLC_RUN_DIR%"
1212

13-
rem Register license if provided
14-
if not "%MLC_GEEKBENCH_UNLOCK_CMD%" == "" (
13+
rem Register license if key is provided
14+
if not "!MLC_GEEKBENCH_LICENSE_KEY!" == "" (
1515
echo.
1616
echo Registering Geekbench license...
17-
%MLC_GEEKBENCH_UNLOCK_CMD%
17+
"!MLC_GEEKBENCH_BIN_WITH_PATH!" --unlock !MLC_GEEKBENCH_LICENSE_EMAIL! !MLC_GEEKBENCH_LICENSE_KEY!
1818
if !ERRORLEVEL! NEQ 0 (
19-
echo WARNING: Geekbench license registration failed ^(continuing anyway^)
19+
echo WARNING: Geekbench license registration failed, continuing anyway
2020
) else (
2121
echo Geekbench license registered successfully.
2222
)
@@ -25,28 +25,28 @@ if not "%MLC_GEEKBENCH_UNLOCK_CMD%" == "" (
2525
echo.
2626
echo ***********************************************************************
2727
echo Running Geekbench benchmark...
28-
echo Command: %MLC_RUN_CMD%
28+
echo Command: !MLC_RUN_CMD!
2929
echo ***********************************************************************
3030
echo.
3131

32-
%MLC_RUN_CMD%
33-
set exitstatus=%ERRORLEVEL%
32+
!MLC_RUN_CMD!
33+
set exitstatus=!ERRORLEVEL!
3434

35-
if %exitstatus% NEQ 0 (
35+
if !exitstatus! NEQ 0 (
3636
echo.
37-
echo Geekbench exited with status: %exitstatus%
38-
exit /b %exitstatus%
37+
echo Geekbench exited with status: !exitstatus!
38+
exit /b !exitstatus!
3939
)
4040

4141
rem Check if results file was created
42-
if exist "%MLC_GEEKBENCH_RESULTS_FILE%" (
42+
if exist "!MLC_GEEKBENCH_RESULTS_FILE!" (
4343
echo.
44-
echo Geekbench results saved to: %MLC_GEEKBENCH_RESULTS_FILE%
44+
echo Geekbench results saved to: !MLC_GEEKBENCH_RESULTS_FILE!
4545
echo.
4646
echo Results summary:
47-
type "%MLC_GEEKBENCH_RESULTS_FILE%"
47+
type "!MLC_GEEKBENCH_RESULTS_FILE!"
4848
echo.
4949
) else (
5050
echo.
51-
echo WARNING: Geekbench results file not found at %MLC_GEEKBENCH_RESULTS_FILE%
51+
echo WARNING: Geekbench results file not found at !MLC_GEEKBENCH_RESULTS_FILE!
5252
)

script/benchmark-program-geekbench/run.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@
22

33
# Benchmark Program - Geekbench (Unix)
44

5+
CUR_DIR=$PWD
6+
57
if [ -z "${MLC_RUN_DIR}" ]; then
68
echo "MLC_RUN_DIR is not set"
79
exit 1
810
fi
911

10-
cd "${MLC_RUN_DIR}"
12+
cd "${MLC_RUN_DIR}" || exit 1
1113

12-
# Register license if provided
13-
if [ -n "${MLC_GEEKBENCH_UNLOCK_CMD}" ]; then
14+
# Register license if key is provided
15+
if [ -n "${MLC_GEEKBENCH_LICENSE_KEY}" ]; then
1416
echo ""
1517
echo "Registering Geekbench license..."
16-
eval ${MLC_GEEKBENCH_UNLOCK_CMD}
17-
if [ $? -ne 0 ]; then
18-
echo "WARNING: Geekbench license registration failed (continuing anyway)"
18+
"${MLC_GEEKBENCH_BIN_WITH_PATH}" --unlock "${MLC_GEEKBENCH_LICENSE_EMAIL}" "${MLC_GEEKBENCH_LICENSE_KEY}"
19+
unlock_status=$?
20+
if [ ${unlock_status} -ne 0 ]; then
21+
echo "WARNING: Geekbench license registration failed (exit code: ${unlock_status}), continuing anyway"
1922
else
2023
echo "Geekbench license registered successfully."
2124
fi

0 commit comments

Comments
 (0)