From 94d4a32a43f042fd4741f60746ea9691ddab7fbf Mon Sep 17 00:00:00 2001 From: druckdev Date: Sat, 29 Jan 2022 23:25:00 +0100 Subject: [PATCH] zsh:funcs:crypt-*mount: Use `err_return` option --- .config/zsh/zshrc.d/40-functions.zsh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index 1435578..f0519e1 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -253,12 +253,13 @@ safe-remove() { } crypt-mount() { - [[ $# -gt 0 ]] || return 1 - [[ -e "$1" ]] || return 1 + emulate -L zsh -o err_return + [[ $# -gt 0 ]] + [[ -e "$1" ]] local name=crypt_"${1##*/}" - sudo cryptsetup open "$1" "$name" || return 1 - udisksctl mount -b /dev/mapper/"$name" || return 1 + sudo cryptsetup open "$1" "$name" + udisksctl mount -b /dev/mapper/"$name" local mount_point="$( findmnt -lo SOURCE,TARGET \ | grep -F /dev/mapper/"$name" \ @@ -268,8 +269,9 @@ crypt-mount() { } crypt-umount() { - [[ $# -gt 0 ]] || return 1 - [[ -e "$1" ]] || return 1 + emulate -L zsh -o err_return + [[ $# -gt 0 ]] + [[ -e "$1" ]] sync