Commit 4463320e authored by Mislav Marohnić's avatar Mislav Marohnić
Browse files

Print OS information on build failure

This is useful info for when someone is pasting build output to our
issue tracker seeking support.
parent 95964b17
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -71,10 +71,21 @@ colorize() {
  fi
}

os_information() {
  if type -p lsb_release >/dev/null; then
    lsb_release -sir | xargs echo
  elif type -p sw_vers >/dev/null; then
    echo "OS X $(sw_vers -productVersion)"
  else
    local os="$(cat /etc/{centos,redhat,fedora,system}-release /etc/debian_version 2>/dev/null | head -1)"
    echo "${os:-$(uname -sr)}"
  fi
}

build_failed() {
  { echo
    colorize 1 "BUILD FAILED"
    echo " ($(version))"
    echo " ($(os_information) using $(version))"
    echo

    if ! rmdir "${BUILD_PATH}" 2>/dev/null; then