Skip to content

Commit

Permalink
fix: don't generate on error if backup file doesn't exists (#1057)
Browse files Browse the repository at this point in the history
Signed-off-by: JrCs <90z7oey02@sneakemail.com>
  • Loading branch information
JrCs committed Dec 23, 2021
1 parent 6bb07b6 commit 288468f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/commands/command-reshim.bash
Expand Up @@ -70,7 +70,7 @@ write_shim_script() {
if [ -f "$shim_path" ]; then
if ! grep -x "# asdf-plugin: ${plugin_name} ${version}" "$shim_path" >/dev/null; then
sed -i.bak -e "s/exec /# asdf-plugin: ${plugin_name} ${version}\\"$'\n''exec /' "$shim_path"
rm "$shim_path".bak
rm -f "$shim_path".bak
fi
else
cat <<EOF >"$shim_path"
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/reshim.bash
Expand Up @@ -20,6 +20,6 @@ remove_shim_for_version() {

if ! grep "# asdf-plugin:" "$shim_path" >/dev/null ||
[ "$count_installed" -eq 0 ]; then
rm "$shim_path"
rm -f "$shim_path"
fi
}
2 changes: 1 addition & 1 deletion lib/commands/version_commands.bash
Expand Up @@ -60,7 +60,7 @@ version_command() {

if [ -f "$file" ] && grep "^$plugin_name " "$file" >/dev/null; then
sed -i.bak -e "s|^$plugin_name .*$|$plugin_name ${resolved_versions[*]}|" "$file"
rm "$file".bak
rm -f "$file".bak
else
printf "%s %s\\n" "$plugin_name" "${resolved_versions[*]}" >>"$file"
fi
Expand Down

0 comments on commit 288468f

Please sign in to comment.