Skip to content

Commit 9ab8ae7

Browse files
committed
Switch CMD str to vector
1 parent ba1b8d6 commit 9ab8ae7

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

build/entrypoint.sh

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4+
# Path to the guidellm binary
5+
guidellm_bin="/opt/guidellm/bin/guidellm"
6+
47
# If we receive any arguments switch to guidellm command
58
if [ $# -gt 0 ]; then
69
echo "Running command: guidellm $*"
7-
exec guidellm "$@"
10+
exec $guidellm_bin "$@"
811
fi
912

10-
# Build the command
11-
CMD="guidellm benchmark --target \"${TARGET}\" --model \"${MODEL}\" --rate-type \"${RATE_TYPE}\" --data \"${DATA}\""
13+
# NOTE: Bash vec + exec prevent shell escape issues
14+
CMD=("${guidellm_bin}" "benchmark" "--target" "${TARGET}" "--model" "${MODEL}" "--rate-type" "${RATE_TYPE}" "--data" "${DATA}")
1215

13-
# Add optional parameters
14-
if [ ! -z "${MAX_REQUESTS}" ]; then
15-
CMD="${CMD} --max-requests ${MAX_REQUESTS}"
16+
if [ -n "${MAX_REQUESTS}" ]; then
17+
CMD+=("--max-requests" "${MAX_REQUESTS}")
1618
fi
1719

18-
if [ ! -z "${MAX_SECONDS}" ]; then
19-
CMD="${CMD} --max-seconds ${MAX_SECONDS}"
20+
if [ -n "${MAX_SECONDS}" ]; then
21+
CMD+=("--max-seconds" "${MAX_SECONDS}")
2022
fi
2123

22-
# Add output path with appropriate extension
23-
if [ ! -z "${OUTPUT_PATH}" ]; then
24-
CMD="${CMD} --output-path \"${OUTPUT_PATH}\""
24+
if [ -n "${OUTPUT_PATH}" ]; then
25+
CMD+=("--output-path" "${OUTPUT_PATH}")
2526
fi
2627

2728
# Execute the command
28-
echo "Running command: ${CMD}"
29-
eval "${CMD}"
29+
echo "Running command: ${CMD[*]}"
30+
exec "${CMD[@]}"

0 commit comments

Comments
 (0)