commit: cd54946e602964006be18c473ae204d77733e891 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> AuthorDate: Tue Apr 13 07:23:35 2021 +0000 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> CommitDate: Mon Apr 19 20:08:15 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cd54946e
elisp-common.eclass: Add timeout to version detection Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org> eclass/elisp-common.eclass | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass index 832fc19e467..bdf97f41303 100644 --- a/eclass/elisp-common.eclass +++ b/eclass/elisp-common.eclass @@ -219,7 +219,9 @@ _ELISP_EMACS_VERSION="" # Output version of currently active Emacs. elisp-emacs-version() { - local version ret + local version ret tmout="timeout -k 5 55" + # Run without timeout if the command is not available + ${tmout} true &>/dev/null || tmout="" # The following will work for at least versions 18-24. echo "(princ emacs-version)" >"${T}"/emacs-version.el version=$( @@ -228,7 +230,7 @@ elisp-emacs-version() { # Redirecting stdin and unsetting TERM and DISPLAY will cause # most of them to exit with an error. unset TERM DISPLAY - ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el </dev/null + ${tmout} ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el </dev/null ) ret=$? rm -f "${T}"/emacs-version.el