posix sh compatible way of checking error on all pipe paths (equivalent to set -o pipestatus in some shells)