From 86b7c1034c7f48a1f819de6ef4305c990a20d309 Mon Sep 17 00:00:00 2001 From: Jason Nader Date: Mon, 2 Mar 2020 21:12:11 +0900 Subject: [PATCH] Prevent prompt from spewing errors if cwd has disappeared --- share/functions/fish_print_hg_root.fish | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/functions/fish_print_hg_root.fish b/share/functions/fish_print_hg_root.fish index 3b64609d6..728c42937 100644 --- a/share/functions/fish_print_hg_root.fish +++ b/share/functions/fish_print_hg_root.fish @@ -7,7 +7,9 @@ function fish_print_hg_root # Find an hg directory above $PWD # without calling `hg root` because that's too slow set -l root - set -l dir (pwd -P) + set -l dir (pwd -P 2>/dev/null) + or return 1 + while test $dir != "/" if test -f $dir'/.hg/dirstate' echo $dir/.hg