Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only execute preexec_install if defined #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kerneis
Copy link

@kerneis kerneis commented Sep 27, 2019

Some external preexec scripts loaded with LONG_RUNNING_PREEXEC_LOCATION
do not use preexec_install, but instead install themselves automatically
when sourced (eg. https://github.com/rcaloras/bash-preexec/). This
commit avoids the error message "preexec_install not found" by skipping
the invocation of preexec_install if it is not defined. command is
defined by POSIX and should be available on all systems.

Tested:
bash 5.0.3 on Linux with bash-preexec 0.3.8.0 Debian package and
LONG_RUNNING_PREEXEC_LOCATION=/usr/share/bash-preexec/bash_preexec.sh

Some external preexec scripts loaded with LONG_RUNNING_PREEXEC_LOCATION
do not use preexec_install, but instead install themselves automatically
when sourced (eg. https://github.com/rcaloras/bash-preexec/). This
commit avoids the error message "preexec_install not found" by skipping
the invocation of preexec_install if it is not defined. `command` is
defined by POSIX and should be available on all systems.

Tested:
  bash 5.0.3 on Linux with bash-preexec 0.3.8.0 Debian package and
  LONG_RUNNING_PREEXEC_LOCATION=/usr/share/bash-preexec/bash_preexec.sh
@kerneis
Copy link
Author

kerneis commented Sep 27, 2019

Note that a work-around for users not applying this patch is to use the following in .bashrc:

export LONG_RUNNING_PREEXEC_LOCATION=/usr/share/bash-preexec/bash_preexec.sh 
preexec_install() {
  return
}
source undistract-me.sh

Base automatically changed from master to main January 16, 2021 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant