From 7b251dbd5854790e92067b4ce37e60e6b93e6a96 Mon Sep 17 00:00:00 2001 From: micbou Date: Tue, 25 Oct 2016 16:03:05 +0200 Subject: [PATCH] Catch CalledProcessError exception in install script This exception is not relevant to the install failure. Catch it and exit with the status code returned by the build script. --- install.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/install.py b/install.py index 36bb70e2..5b77aafe 100755 --- a/install.py +++ b/install.py @@ -22,15 +22,22 @@ DIR_OF_THIS_SCRIPT = p.dirname( p.abspath( __file__ ) ) DIR_OF_OLD_LIBS = p.join( DIR_OF_THIS_SCRIPT, 'python' ) +def CheckCall( args, **kwargs ): + try: + subprocess.check_call( args, **kwargs ) + except subprocess.CalledProcessError as error: + sys.exit( error.returncode ) + + def Main(): build_file = p.join( DIR_OF_THIS_SCRIPT, 'third_party', 'ycmd', 'build.py' ) if not p.isfile( build_file ): - sys.exit( 'File ' + build_file + ' does not exist; you probably forgot ' - 'to run:\n\tgit submodule update --init --recursive\n\n' ) + sys.exit( + 'File {0} does not exist; you probably forgot to run:\n' + '\tgit submodule update --init --recursive\n'.format( build_file ) ) - python_binary = sys.executable - subprocess.check_call( [ python_binary, build_file ] + sys.argv[1:] ) + CheckCall( [ sys.executable, build_file ] + sys.argv[ 1: ] ) # Remove old YCM libs if present so that YCM can start. old_libs = (