From 0f35ac91b7755d60e97d95ff41725c21dbce5f55 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Mon, 2 May 2016 12:51:03 -0400 Subject: [PATCH] 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. --- src/util/cstyle-file.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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() -- 2.47.2