Prevent clean_plugins from deleting root
If tmux was not yet configured to initialize the Tmux Plugin Manager, the variable for the plugin home was not being set. This was resulting in a `rm -rf /` which is pretty nuclear. Fixes: https://github.com/tmux-plugins/tpm/issues/58
This commit is contained in:
parent
cfaf15b768
commit
1579534c2e
2 changed files with 14 additions and 0 deletions
|
@ -31,9 +31,22 @@ _sourced_files() {
|
||||||
awk '/^[ \t]*source(-file)? +/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $2 }'
|
awk '/^[ \t]*source(-file)? +/ { gsub(/'\''/,""); gsub(/'\"'/,""); print $2 }'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Want to be able to abort in certain cases
|
||||||
|
trap "exit 1" TERM
|
||||||
|
export TOP_PID=$$
|
||||||
|
|
||||||
|
_fatal_error_abort() {
|
||||||
|
echo >&2 "Aborting."
|
||||||
|
kill -s TERM $TOP_PID
|
||||||
|
}
|
||||||
|
|
||||||
# PUBLIC FUNCTIONS BELOW
|
# PUBLIC FUNCTIONS BELOW
|
||||||
|
|
||||||
tpm_path() {
|
tpm_path() {
|
||||||
|
if [ "$_CACHED_TPM_PATH" == "/" ]; then
|
||||||
|
echo >&2 "FATAL: Tmux Plugin Manager not configured in tmux.conf"
|
||||||
|
_fatal_error_abort
|
||||||
|
fi
|
||||||
echo "$_CACHED_TPM_PATH"
|
echo "$_CACHED_TPM_PATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ update_plugins() {
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
ensure_tpm_path_exists
|
||||||
if [ "$1" == "all" ]; then
|
if [ "$1" == "all" ]; then
|
||||||
update_all
|
update_all
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue