Skip to content
Snippets Groups Projects
Commit 424830b0 authored by Sebastian Meiling's avatar Sebastian Meiling
Browse files

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.
parent 1f2985df
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,10 @@ get_cmd_version() { ...@@ -8,6 +8,10 @@ get_cmd_version() {
local cmd="$1" local cmd="$1"
if command -v "$cmd" 2>&1 >/dev/null; then if command -v "$cmd" 2>&1 >/dev/null; then
ver=$("$cmd" --version 2> /dev/null | head -n 1) 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 if [ -z "$ver" ]; then
ver="error" ver="error"
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment