add safety check to avoid infinite cat hang

This commit is contained in:
Isaac 2023-05-05 00:01:45 -07:00
parent b557d635fd
commit 5a7a1747f2
No known key found for this signature in database
GPG key ID: E69FB5A841448A48

View file

@ -161,6 +161,7 @@ def fish_completion():
function __borgmatic_check_version function __borgmatic_check_version
set -fx this_filename (status current-filename) set -fx this_filename (status current-filename)
fish -c ' fish -c '
if test -f "$this_filename"
set this_script (cat $this_filename 2> /dev/null) set this_script (cat $this_filename 2> /dev/null)
set installed_script (borgmatic --fish-completion 2> /dev/null) set installed_script (borgmatic --fish-completion 2> /dev/null)
if [ "$this_script" != "$installed_script" ] && [ "$installed_script" != "" ] if [ "$this_script" != "$installed_script" ] && [ "$installed_script" != "" ]
@ -170,6 +171,7 @@ def fish_completion():
'$this_filename', '$this_filename',
)}" )}"
end end
end
' & ' &
end end
__borgmatic_check_version __borgmatic_check_version