From: Greg Hudson Date: Mon, 2 May 2016 16:51:03 +0000 (-0400) Subject: Fix cstyle-file.py when emacs is not installed X-Git-Tag: krb5-1.15-beta1~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f35ac91b7755d60e97d95ff41725c21dbce5f55;p=thirdparty%2Fkrb5.git Fix cstyle-file.py when emacs is not installed emacs_reindent() is intended to fail gracefully when emacs is not installed, but instead subprocess.call() throws an OSError. Check for this error and return normally. --- diff --git a/src/util/cstyle-file.py b/src/util/cstyle-file.py index a080feff31..7e90b661f7 100644 --- a/src/util/cstyle-file.py +++ b/src/util/cstyle-file.py @@ -76,7 +76,12 @@ def emacs_reindent(lines): args = ['emacs', '-q', '-batch', '-l', cstyle_el, '-l', reindent_el, f.name] with open(os.devnull, 'w') as devnull: - if call(args, stdin=devnull, stdout=devnull, stderr=devnull) != 0: + try: + st = call(args, stdin=devnull, stdout=devnull, stderr=devnull) + if st != 0: + return None + except OSError: + # Fail gracefully if emacs isn't installed. return None f.seek(0) ilines = f.readlines()