From 7f8d8beb06d2ca230a1d48d5cddb1b67833e0bd2 Mon Sep 17 00:00:00 2001 From: Dmitriy Nikiforov Date: Tue, 1 Aug 2017 16:55:35 +0300 Subject: [PATCH] Add sdb shell wrapper with 'printf' --- infra/commands/publish.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/infra/commands/publish.sh b/infra/commands/publish.sh index 4de3e16..83824ad 100755 --- a/infra/commands/publish.sh +++ b/infra/commands/publish.sh @@ -26,7 +26,7 @@ EOF ######################################################## # Workaround for 'sdb shell' inability to propagate error codes -function sdb_shell { +function sdb_shell_verbose { set +e error_str='SDB_ERROR' @@ -42,9 +42,19 @@ function sdb_shell { exit 1 fi + if [[ -n ${output} ]]; then + # strip last '\r' character + printf "%s" "${output::(-1)}" + fi + set -e } +# Silent version +function sdb_shell { + sdb_shell_verbose ${@} >/dev/null +} + ######################################################## # GLOBAL VARIABLES ######################################################## @@ -114,7 +124,7 @@ fi echo "Checking architecture..." declare -A archs=([x86_64]='x86_64' [i686]='i586') -ARCH=${archs["$(sdb_shell_print uname -m)"]} +ARCH=${archs["$(sdb_shell_verbose uname -m)"]} if [[ -z ${ARCH} || ! -d ${TARGET_DIR}/${ARCH} ]]; then echo "Error: there is no built ${target_name} for ${ARCH} architecture." exit 1 -- 2.7.4