Procházet zdrojové kódy

Capture return code

Bob Mottram před 8 roky
rodič
revize
849430b2ce
1 změnil soubory, kde provedl 7 přidání a 5 odebrání
  1. 7
    5
      src/freedombone-controlpanel

+ 7
- 5
src/freedombone-controlpanel Zobrazit soubor

@@ -960,13 +960,14 @@ function restore_data_from_storage {
960 960
             app_name=${app_list[app_index]}
961 961
             if [[ $app_name == "$AllStr" ]]; then
962 962
                 $restore_command
963
-                if [ ! "$?" = "0" ]; then
963
+                retcode="$?"
964
+                if [[ "$retcode" != "0" ]]; then
964 965
                     if [[ "$1" == "local" ]]; then
965 966
                         dialog --title $"Restore all apps from USB" \
966
-                               --msgbox $"Restore failed with code $?" 6 40
967
+                               --msgbox $"Restore failed with code $retcode" 6 40
967 968
                     else
968 969
                         dialog --title $"Restore all apps from $1" \
969
-                               --msgbox $"Restore failed with code $?" 6 40
970
+                               --msgbox $"Restore failed with code $retcode" 6 40
970 971
                     fi
971 972
                     return
972 973
                 fi
@@ -989,9 +990,10 @@ function restore_data_from_storage {
989 990
             app_name=${app_list[app_index]}
990 991
             if [ ${#app_name} -gt 0 ]; then
991 992
                 $restore_command "${app_name}"
992
-                if [ ! "$?" = "0" ]; then
993
+                retcode="$?"
994
+                if [[ "$retcode" != "0" ]]; then
993 995
                     dialog --title $"Restore apps from USB" \
994
-                           --msgbox $"Restore of ${app_name} failed with code $?" 6 40
996
+                           --msgbox $"Restore of ${app_name} failed with code $retcode" 6 40
995 997
                     return
996 998
                 fi
997 999
             fi