Add sdb shell wrapper with 'printf'
authorDmitriy Nikiforov <d.nikiforov@partner.samsung.com>
Tue, 1 Aug 2017 13:55:35 +0000 (16:55 +0300)
committerMaria Guseva <m.guseva@samsung.com>
Mon, 14 Aug 2017 16:52:21 +0000 (19:52 +0300)
infra/commands/publish.sh

index 4de3e16..83824ad 100755 (executable)
@@ -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