mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
fix: don't generate on error if backup file doesn't exists (#1057)
Signed-off-by: JrCs <90z7oey02@sneakemail.com>
This commit is contained in:
parent
6bb07b6d36
commit
288468f93f
@ -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"
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user