diff options
author | Ulrich Müller <ulm@gentoo.org> | 2013-08-02 16:48:18 +0000 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2013-08-02 16:48:18 +0000 |
commit | c200e53be6de031e51dfca2c32bbfbfb8529dece (patch) | |
tree | 295cdafcbf9b47f6c4163befc1029120fcb7f444 /eclass/elisp-common.eclass | |
parent | Version bump (bug #479514). (diff) | |
download | historical-c200e53be6de031e51dfca2c32bbfbfb8529dece.tar.gz historical-c200e53be6de031e51dfca2c32bbfbfb8529dece.tar.bz2 historical-c200e53be6de031e51dfca2c32bbfbfb8529dece.zip |
Sync from Emacs overlay: Make elisp-emacs-version() more robust.
Diffstat (limited to 'eclass/elisp-common.eclass')
-rw-r--r-- | eclass/elisp-common.eclass | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass index 466818e47f9e..fe1305fdd9e6 100644 --- a/eclass/elisp-common.eclass +++ b/eclass/elisp-common.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.84 2013/03/16 08:55:30 ulm Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.85 2013/08/02 16:48:18 ulm Exp $ # # @ECLASS: elisp-common.eclass # @MAINTAINER: @@ -173,16 +173,28 @@ BYTECOMPFLAGS="-L ." # Output version of currently active Emacs. elisp-emacs-version() { - local ret + local version ret # The following will work for at least versions 18-24. echo "(princ emacs-version)" >"${T}"/emacs-version.el - ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el + version=$( + # EMACS could be a microemacs variant that ignores the -batch + # option and would therefore hang, waiting for user interaction. + # 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 + ) ret=$? rm -f "${T}"/emacs-version.el if [[ ${ret} -ne 0 ]]; then eerror "elisp-emacs-version: Failed to run ${EMACS}" + return ${ret} + fi + if [[ -z ${version} ]]; then + eerror "elisp-emacs-version: Could not determine Emacs version" + return 1 fi - return ${ret} + echo "${version}" } # @FUNCTION: elisp-need-emacs |