Browse Source

fix: prevent noclobber issues on /dev/null

This seems like the reason for the jenv-shim being left behind i.e.
rehash is run, the shim is created but we can't redirect to stderr
because of noclobber. This causes rehash to exit because of set -e but
does so before the trap is established to clean up the shim. Further
rehash executions fail because of the existence of the shim.

See https://github.com/rbenv/rbenv/issues/759#issuecomment-289326891
pull/462/head
andrewflbarnes 2 weeks ago
parent
commit
d952c5470d
No known key found for this signature in database
  1. 2
      libexec/jenv-rehash

2
libexec/jenv-rehash

@ -30,7 +30,7 @@ fi @@ -30,7 +30,7 @@ fi
# to stderr and exit with a non-zero status.
set -o noclobber
{ echo > "$PROTOTYPE_SHIM_PATH"
} 2>/dev/null ||
} 2>| /dev/null ||
{ echo "jenv: cannot rehash: $PROTOTYPE_SHIM_PATH exists, try 'jenv rehash --force' to override"
exit 1
} >&2

Loading…
Cancel
Save