From d451beb64e56c866fd74f14639db0b5e1e6614bb Mon Sep 17 00:00:00 2001 From: Amolith Date: Wed, 6 Aug 2025 18:58:07 -0600 Subject: [PATCH] refactor(sshtmp): simplify cleanup logic The `try...finally` block was removed as the `rm -rf` command will still execute at the end of the function regardless of the `ssh` command's exit status. This simplifies the code without changing the cleanup behavior. --- dot_config/private_fish/functions/sshtmp.fish | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/dot_config/private_fish/functions/sshtmp.fish b/dot_config/private_fish/functions/sshtmp.fish index 2b820772d2c6e5cf8cc42531ae45d7da3a21aaa6..2cac53d7aa58b931446bbd1376ac6acdccce2fcd 100644 --- a/dot_config/private_fish/functions/sshtmp.fish +++ b/dot_config/private_fish/functions/sshtmp.fish @@ -10,14 +10,11 @@ function sshtmp --description "Connect to an SSH host using a temporary, one-tim set -l tmp_dir (mktemp -d) set -l key_path "$tmp_dir/id_ed25519" - try - ssh-keygen -t ed25519 -f "$key_path" -N "" -C "sshtmp temporary key for $destination" >/dev/null - command ssh -i "$key_path" \ - -o IdentitiesOnly=yes \ - -o StrictHostKeyChecking=no \ - -o UserKnownHostsFile=/dev/null \ - $destination - finally - rm -rf "$tmp_dir" - end + ssh-keygen -t ed25519 -f "$key_path" -N "" -C "sshtmp temporary key for $destination" >/dev/null + command ssh -i "$key_path" \ + -o IdentitiesOnly=yes \ + -o StrictHostKeyChecking=no \ + -o UserKnownHostsFile=/dev/null \ + $destination + rm -rf "$tmp_dir" end