]> rtime.felk.cvut.cz Git - novaboot.git/blobdiff - tests/wvtest.sh
Copy files to TFTP server with default permissions
[novaboot.git] / tests / wvtest.sh
index 71fac2ba1b9c9982f26c0db09ac2094a87c466c4..6c15ca9ec8646d3983e44a5f467cfe4740cf7785 100644 (file)
@@ -46,7 +46,7 @@ _wvcheck()
        fi
        echo "! $WVCALLER_FILE:$WVCALLER_LINE  $TEXT  $OK" >&2
        if [ "$CODE" -ne 0 ]; then
-               exit $CODE
+               return $CODE
        else
                return 0
        fi
@@ -68,6 +68,23 @@ WVPASS()
        fi
 }
 
+# Use WVPASSSH instead of WVPASS when the command includes pipe or
+# output redirection. The whole command must be one argument - quote
+# it.
+WVPASSSH()
+{
+       TEXT="$1"
+
+       _wvfind_caller
+       if bash -o pipefail -c "$@"; then
+               _wvcheck 0 "$TEXT"
+               return 0
+       else
+               _wvcheck 1 "$TEXT"
+               # NOTREACHED
+               return 1
+       fi
+}
 
 WVFAIL()
 {