From 4ea53419d3dc632f569db5a7613aff8b2818dbc3 Mon Sep 17 00:00:00 2001 From: Arjun Suresh Date: Fri, 1 Nov 2024 12:09:59 +0000 Subject: [PATCH] Improvements to version detect for get-generic-sys-util --- script/get-generic-sys-util/_cm.json | 3 ++- script/get-generic-sys-util/detect.sh | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/script/get-generic-sys-util/_cm.json b/script/get-generic-sys-util/_cm.json index 8db37db16e..bdf81d8d6e 100644 --- a/script/get-generic-sys-util/_cm.json +++ b/script/get-generic-sys-util/_cm.json @@ -460,7 +460,8 @@ "CM_SYS_UTIL_NAME": "md5sha1sum", "CM_SYS_UTIL_VERSION_CMD": "md5sum --version", "CM_SYS_UTIL_VERSION_RE": "\\b(\\d+\\.\\d+(?:\\.\\d+)?)\\b", - "CM_TMP_VERSION_DETECT_GROUP_NUMBER": 0 + "CM_TMP_VERSION_DETECT_GROUP_NUMBER": 0, + "CM_SYS_UTIL_VERSION_CMD_USE_ERROR_STREAM": "yes" }, "new_env_keys": ["CM_MD5SHA1SUM_VERSION"], "state": { diff --git a/script/get-generic-sys-util/detect.sh b/script/get-generic-sys-util/detect.sh index 6f2e3759bd..4095d0fbdf 100644 --- a/script/get-generic-sys-util/detect.sh +++ b/script/get-generic-sys-util/detect.sh @@ -1,7 +1,14 @@ #!/bin/bash if [[ -n "${CM_SYS_UTIL_VERSION_CMD}" ]]; then - ${CM_SYS_UTIL_VERSION_CMD} > tmp-ver.out + if [[ "${CM_SYS_UTIL_VERSION_CMD_USE_ERROR_STREAM}" == "yes" ]]; then + # Redirect both stdout and stderr to tmp-ver.out + cmd="${CM_SYS_UTIL_VERSION_CMD} > tmp-ver.out 2>&1" + else + cmd="${CM_SYS_UTIL_VERSION_CMD} > tmp-ver.out" + fi + echo $cmd + eval $cmd + test $? -eq 0 || exit $? fi -test $? -eq 0 || exit $?