1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

dist/tools: parse version info from stderr

Currently version information of commands and tools is only parsed
from STDOUT, however some tools like openocd print version info
to STDERR only. This commits adds parsing of STDERR for version
infos if STDOUT does not contain such info.
This commit is contained in:
smlng 2018-09-19 13:23:48 +02:00
parent 1f2985dfc6
commit 424830b06b

View File

@ -8,6 +8,10 @@ get_cmd_version() {
local cmd="$1"
if command -v "$cmd" 2>&1 >/dev/null; then
ver=$("$cmd" --version 2> /dev/null | head -n 1)
# some tools (eg. openocd) print version info to stderr
if [ -z "$ver" ]; then
ver=$("$cmd" --version 2>&1 | head -n 1)
fi
if [ -z "$ver" ]; then
ver="error"
fi